3.2.4.2.1.2 Item (get) (Opnum 8)

The Item method returns a pointer to the object at the requested position in the collection of Objects Being Enumerated.

 [propget, id(DISPID_VALUE)] HRESULT Item(
   [in] long index,
   [out, retval] VARIANT* item
 );

index: The position of the item in the collection of Objects Being Enumerated to return.

item: Pointer to a VARIANT structure. Upon successful completion, receives the pointer to the IDispatch interface for the object.

Return Values: The method MUST return zero on success, or a nonzero error code on failure.

Return value/code

Description

0x80004003

E_POINTER

The item parameter is NULL.

0x80131502

COR_E_ARGUMENTOUTOFRANGE

The value of the index parameter is greater than the number of Objects Being Enumerated in the collection.

Upon receiving this message, the server MUST validate parameters:

  • Verify that index is not greater than the number of Objects Being Enumerated in the collection.

  • Verify that item is not NULL.

If any validation fails, the server MUST terminate processing and return a nonzero error code.

The server MUST set item to the IDispatch interface of the corresponding object at the index location in the collection of Objects Being Enumerated.