3.1.4.13.3 AddElement (Opnum 5)

The AddElement method is received by the server in an RPC_REQUEST packet. In response, the server attempts to add a newly created IAppHostElement object to the specified collection.

This function adds an element to the current collection of elements.

 HRESULT AddElement(
   [in] IAppHostElement* pElement,
   [in, defaultvalue(-1)] int cPosition
 );

pElement: The element to add to the collection.

cPosition: The position at which the element was added to the collection. If -1, the new element is appended. Otherwise, the position represents the zero-based index to the collection.

Return Values: The server MUST return zero if it successfully processes the message that is received from the client. If processing fails, the server MUST return a nonzero HRESULT code as defined in [MS-ERREF]. The following table describes the error conditions that MUST be handled and the corresponding error codes. A server MAY return additional implementation-specific error codes.

Return value/code

Description

0X00000000

NO_ERROR

The operation completed successfully.

0X80070057

ERROR_INVALID_PARAMETER

One or more parameters are incorrect or null.

0X00000008

ERROR_NOT_ENOUGH_MEMORY

Not enough memory is available to process this command.

0X80070021

ERROR_LOCK_VIOLATION

The instance is not editable.

0X80070585

ERROR_INVALID_INDEX

The index specified by cPosition is invalid.