Export (0) Print
Expand All

HtmlDocument.DomDocument Property

Gets the unmanaged interface pointer for this HtmlDocument.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public Object DomDocument { get; }

Property Value

Type: System.Object
An Object representing an IDispatch pointer to the unmanaged document.

HtmlDocument is a wrapper for the Internet Explorer Document Object Model (DOM), which is written in COM. If you need to access unexposed properties or methods on the underlying COM interfaces, such as IHTMLDocument2, you can use this object to query for them.

To use the unmanaged interfaces, import the MSHTML library (mshtml.dll) into your application. However, you can also execute unexposed properties and methods using the IDispatch::Invoke method.

The following code example casts the DomDocument to an IHTMLDocument2 pointer and displays the value of the lastModified property, which tells when the owner of the document last updated its contents. The code example requires that you have a Button on your form named Button6.

private string GetLastModifiedDate()
{
    if (webBrowser1.Document != null)
    {
        MSHTML.IHTMLDocument2 currentDoc = (MSHTML.IHTMLDocument2)webBrowser1.Document.DomDocument;
        return (currentDoc.lastModified);
    }
    else
    {
        return ("");
    }
}

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft