HtmlDocument.DomDocument Property

Definition

Gets the unmanaged interface pointer for this HtmlDocument.

C#
public object DomDocument { get; }

Property Value

An Object representing an IDispatch pointer to the unmanaged document.

Examples

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.

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

Remarks

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.

Applies to

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

See also