HtmlDocument.DomDocument 屬性

定義

會取得非 HtmlDocument管理介面指標。

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

屬性值

一個 Object 代表 IDispatch 指向未管理文件的指標。

範例

以下程式碼範例將 DomDocument 投射為 IHTMLDocument2 指標,並顯示屬性的 lastModified 值,以告知文件擁有者最後一次更新內容的時間。 程式碼範例要求你的表單上有一個 Button 名為 Button6的 。

private string GetLastModifiedDate()
{
    if (webBrowser1.Document != null)
    {
        MSHTML.IHTMLDocument2 currentDoc = (MSHTML.IHTMLDocument2)webBrowser1.Document.DomDocument;
        return (currentDoc.lastModified);
    }
    else
    {
        return ("");
    }
}
Private Function GetLastModifiedDate() As String
    If (Not (WebBrowser1.Document Is Nothing)) Then
        Dim CurrentDocument As Object = WebBrowser1.Document.DomDocument
        GetLastModifiedDate = CurrentDocument.lastModified
    Else
        GetLastModifiedDate = Nothing
    End If
End Function

備註

HtmlDocument 是 Internet Explorer 文件物件模型(DOM)的包裝器,該模型以 COM 撰寫。 如果你需要存取底層 COM 介面上未暴露的屬性或方法,例如 IHTMLDocument2,你可以用這個物件來查詢它們。

要使用非管理介面,請將 MSHTML 函式庫(mshtml.dll)匯入你的應用程式。 不過,你也可以用這個 IDispatch::Invoke 方法執行未暴露的屬性和方法。

適用於

另請參閱