HtmlWindow.DomWindow 属性

定义

获取此类包装的非托管接口。

public:
 property System::Object ^ DomWindow { System::Object ^ get(); };
public object DomWindow { get; }
member this.DomWindow : obj
Public ReadOnly Property DomWindow As Object

属性值

Object

可转换为、IHTMLWindow2IHTMLWindow3IHTMLWindow4指针的对象。

示例

下面的代码示例从文档窗口获取指针 IHTMLWindow2 ,并在模式窗口中显示新文档。

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);
    }
}
Private Sub ShowModalDialog()
    If (WebBrowser1.Document IsNot Nothing) Then
        Dim Frame As HtmlWindow = WebBrowser1.Document.Window

        Dim DialogArguments As String = "dialogHeight: 250px; dialogWidth: 300px; dialogTop: 300px;" & _
            "dialogLeft: 300px; edge: Sunken; center: Yes; help: Yes; resizable: No; status: No;"

        ' Show the dialog.
        Dim RawWindow As mshtml.IHTMLWindow2 = Frame.DomWindow
        RawWindow.showModalDialog("http://www.adatum.com/dialogWindow.htm", Nothing, CObj(DialogArguments))
    End If
End Sub

注解

使用文档对象模型的基础非托管接口指针 (DOM) 执行不公开 HtmlWindow的方法。

必须添加对非托管MSHTML.dll的引用才能使用 DomWindow。 有关详细信息,请参阅 将类型库作为程序集导入

适用于

另请参阅