Gets the automation object of the active document, if any.
HRESULT IWebBrowser2::get_Document(IDispatch **ppDisp);
- Address of a pointer to a variable of type IDispatch interface that receives the automation object.
Returns one of the following values.
S_OK The operation completed successfully. S_FALSE Windows Internet Explorer 7. The object was not safe for scripting. E_FAIL The operation failed. E_INVALIDARG One or more arguments are invalid. E_NOINTERFACE No such interface is supported.
When the active document is an HTML page, this property provides access to the contents of the HTML Document Object Model (DOM). Specifically, it returns an IDispatch interface pointer to the HTMLDocument component object class (coclass). The HTMLDocument coclass is functionally equivalent to the Dynamic HTML (DHTML) document object used in HTML script. It supports all the required properties and methods to access the entire contents of the active HTML document.
When other document types are active, such as a Microsoft Word document, this property returns the default IDispatch dispatch interface (dispinterface) pointer for the hosted document object. For Word documents, this is functionally equivalent to the Document object in the Word object model. For more information on the Microsoft Office DOM, refer to the Microsoft Office Developer Center.Warning If the document object type is not safe for scripting, this method returns successfully but sets ppDisp to NULL. For Internet Explorer 7 and later, the return code is S_FALSE rather than S_OK. For more information, see Safe Initialization and Scripting for ActiveX Controls.