メンバ アクセス式またはインデックス式の対象が Object 型である場合、式の処理は実行時まで遅延できます。このように処理を遅延させることを "遅延バインディング" と呼びます。 {3050F4E7-98B5-11CF-BB82-00AA00BDCE0B}IE9のGUIDです。 Microsoft Visual Basic .NET のコード Imports System.Runtime.InteropServices Imports System.Reflection Private Sub AxWebBrowser1_DocumentComplete(ByVal sender As Object, _ ByVal e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent) _ Handles AxWebBrowser1.DocumentComplete Dim htm As Object Dim typ As Type Dim docTitle As String typ = Type.GetTypeFromCLSID(New System.Guid("{3050F4E7-98B5-11CF-BB82-00AA00BDCE0B}")) htm = AxWebBrowser1.Document docTitle = typ.InvokeMember("title", BindingFlags.GetProperty, Nothing, htm, Nothing) MessageBox.Show("Title is " & docTitle) End Sub Microsoft Visual C# .NET のコード using System.Runtime.InteropServices; using System.Reflection; private void DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e) { object htm; Type typ; string docTitle; typ = Type.GetTypeFromCLSID(new System.Guid("{3050F4E7-98B5-11CF-BB82-00AA00BDCE0B}")); htm = axWebBrowser1.Document; docTitle = typ.InvokeMember("title", BindingFlags.GetProperty, null, htm, null).ToString(); MessageBox.Show("Title is " + docTitle); } 本当にほしかったのはこういうブログだったんだ コメント: |