HtmlWindow.DomWindow Property

Definition

Gets the unmanaged interface wrapped by this class.

C#
public object DomWindow { get; }

Property Value

An object that can be cast to an IHTMLWindow2, IHTMLWindow3, or IHTMLWindow4 pointer.

Examples

The following code example obtains an IHTMLWindow2 pointer from a document's window and displays a new document in a modal window.

C#
private void ShowModalDialog()
{
    if (!(webBrowser1.Document == null)) 
    {
        HtmlWindow frame = webBrowser1.Document.Window;

        String dialogArguments = "dialogHeight: 250px; dialogWidth: 300px; dialogTop: 300px;" + 
            "dialogLeft: 300px; edge: Sunken; center: Yes; help: Yes; resizable: No; status: No;";

        // Show the dialog.
        mshtml.IHTMLWindow2 rawWindow = (mshtml.IHTMLWindow2)frame.DomWindow;
        Object o = new Object();
        Object args = (Object)dialogArguments;
        rawWindow.showModalDialog("http://www.adatum.com/dialogWindow.htm", ref o, ref args);
    }
}

Remarks

Use the underlying unmanaged interface pointers to the Document Object Model (DOM) to execute methods not exposed by HtmlWindow.

You must add a referenced to the unmanaged MSHTML.dll in order to use DomWindow. For more information, see Importing a Type Library as an Assembly.

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