Share via


HtmlDocument.DomDocument 屬性

定義

取得此 HtmlDocument 的 Unmanaged 介面指標。

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

屬性值

Object

Object 表示 Unmanaged 檔的 IDispatch 指標。

範例

下列程式碼範例會將 DomDocument IHTMLDocument2 轉換成指標,並顯示 屬性的值 lastModified ,指出檔的擁有者上次更新其內容的時間。 程式碼範例會要求您在名為 Button6 的表單上擁有 Button

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 MSHTML.IHTMLDocument2 = WebBrowser1.Document.DomDocument
        GetLastModifiedDate = CurrentDocument.lastModified
    Else
        GetLastModifiedDate = Nothing
    End If
End Function

備註

HtmlDocument 是 Internet Explorer 檔物件模型 (DOM) 的包裝函式,以 COM 撰寫。 如果您需要存取基礎 COM 介面上的未公開屬性或方法,例如 IHTMLDocument2 ,您可以使用這個物件來查詢它們。

若要使用 Unmanaged 介面,請將 MSHTML 程式庫 (mshtml.dll) 匯入您的應用程式。 不過,您也可以使用 IDispatch::Invoke 方法來執行未公開的屬性和方法。

適用於

另請參閱