共用方式為


HtmlWindow.DomWindow 屬性

定義

取得這個類別所包裝的 Unmanaged 介面。

public:
 property System::Object ^ DomWindow { System::Object ^ get(); };
public object DomWindow { get; }
member this.DomWindow : obj
Public ReadOnly Property DomWindow As 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

備註

使用檔物件模型的基礎 Unmanaged 介面指標 (DOM) 來執行未公開 HtmlWindow 的方法。

您必須將參考新增至 Unmanaged MSHTML.dll,才能使用 DomWindow 。 如需詳細資訊,請參閱 將型別程式庫匯入為元件

適用於

另請參閱