サポート技術情報 - 182033 
[VB] BeforeNavigate2 を利用し HTML からイベントを取得する 
http://support.microsoft.com/default.aspx?kbid=182033
より
      Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, _
           URL As Variant, Flags As Variant, _
           TargetFrameName As Variant, PostData As Variant, _
           Headers As Variant, Cancel As Boolean)
          Dim Ev As String
          If UCase$(Left$(URL, 6)) = "EVENT:" Then
              'this is our event, process it and cancel navigation
              Ev = UCase$(Mid$(URL, 7))
              Select Case Ev
                  Case "HELLO"
                      MsgBox "Hello from VB App"
                      'set a field on HTML page
                      WebBrowser1.Document.All("field1").Value = _
                          "Hello from VB"
                  Case "CLOSE"
                      If MsgBox("Are you sure you want to exit?", _
                  vbYesNo) = vbYes Then
                          End
                      End If
              End Select
              Cancel = True
          End If
      End Sub
投稿日:2004/02/09 02:21 
投稿者:近藤
 
返信 引用返信 修正 削除