CDHtmlDialog::GetElement

Returns an interface on the HTML element specified by szElementId.

HRESULT GetElement( 
   LPCTSTR szElementId, 
   IDispatch **ppdisp, 
   BOOL *pbCollection = NULL  
); 
HRESULT GetElement( 
   LPCTSTR szElementId, 
   IHTMLElement **pphtmlElement  
);

Parameters

  • szElementId
    The ID of an HTML element.

  • ppdisp
    An IDispatch pointer to the requested element or collection of elements.

  • pbCollection
    A BOOL indicating whether the object represented by ppdisp is a single element or a collection of elements.

  • pphtmlElement
    An IHTMLElement pointer to the requested element.

Return Value

A standard HRESULT value.

Remarks

Use the first overload if you need to handle conditions in which there may be more than one element with the specified ID. You can use the last parameter to find out whether the returned interface pointer is to a collection or a single item. If the interface pointer is on a collection, you can query for the IHTMLElementCollection and use its item property to refer to the elements by ordinal position.

The second overload will fail if there is more than one element with the same ID in the page.

Requirements

Header: afxdhtml.h

See Also

Reference

CDHtmlDialog Class

Hierarchy Chart

CDHtmlDialog::GetElementInterface

CDHtmlDialog::GetControlDispatch

Other Resources

CDHtmlDialog Members