Click to return to the Reusing Browser Technology home page    
IWebBrowser2::get_Contain...     IWebBrowser2::get_FullNam...     IWebBrowser2 Interface    
Web Workshop  |  Reusing Browser Technology

IWebBrowser2::get_Document Method


Returns an IDispatch interface pointer to the active document, if any.

Syntax

HRESULT get_Document(
    IDispatch **ppDisp
);

Parameters

ppDisp
Address of an IDispatch variable that receives the pointer to the object's IDispatch interface.

Return Value

Returns one of the following values:

S_OK The operation was successful.
E_FAIL The operation failed.
E_INVALIDARG One or more parameters are invalid.
E_NOINTERFACE The interface is not supported.

Remarks

When the active document is an HTML page, the IWebBrowser2::get_Document method provides access to the contents of the HTML document object model. Specifically, it returns an IDispatch interface pointer to the HTMLDocument component object class (coclass). The HTMLDocument coclass is functionally equivalent to the DHTML document object used in HTML script. It supports all the properties and methods necessary to access the entire contents of the active HTML document.

C++ programs can retrieve the COM interfaces IHTMLDocument, IHTMLDocument2, and IHTMLDocument3 by calling QueryInterface on the IDispatch received from the IWebBrowser2::get_Document method.

When other document types are active, such as a Microsoft® Word document, the Document property of an IHTMLDocument returns the default IDispatch dispatch interface (dispinterface) pointer for the hosted document object. For Word documents, this would be functionally equivalent to the Document object in the Word object model. For more information on the document object models of Microsoft® Office documents, refer to the Microsoft Office Development Documentation on MSDN Non-MSDN link.

Windows CE

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

See Also

IWebBrowser2::get_Application, IWebBrowser2::get_Container, IWebBrowser2::get_Parent


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.