Click to return to the Reusing Browser Technology home page    
IHTMLElementCollection::g...     IHTMLElementCollection::i...     IHTMLElementCollection In...    
Web Workshop  |  Reusing Browser Technology

IHTMLElementCollection::item Method


Retrieves an object or a collection from the given collection.

Syntax

HRESULT item(
    VARIANT name,
    VARIANT index,
    IDispatch **pdisp
);

Parameters

name
VARIANT structure that contains a string or value that specifies the object or collection to retrieve. If this parameter is a number, the method returns the object in the collection at the given position, where the first object has value 0, the second has 1, and so on. If this parameter contains a string, the method returns a collection of objects, where the value of the name or id property for each object is equal to the string.
index
VARIANT structure that contains a value that specifies the position of an object to retrieve. This parameter is used when name is a string. The method uses the string to construct a collection of all objects that have a name or id equal to the string, then retrieves from this collection the element at the position specified by index.
pdisp
Address of a pointer to an IDispatch interface that receives the collection or object.

Return Value

Returns S_OK if successful, or an error code otherwise.

Remarks

The name parameter determines which action to take. This function returns an S_OK even if the element is not found. The programmer should check the value of the pdisp (IDispatch) pointer returned by this call. If the value of the pointer is NULL, the element was not found and the call was not successful.

Windows CE

Windows CE Use version 2.12 and later
Minimum availability Internet Explorer 4.0


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.