掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
WebBrowsers\誇餅調廾りツ廸餅するには? (ID:81798)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
「スクリプトエラー」の内容によっては、NavigateComplete2イベント発生時に、pDisp.Document.parentWindow を捕らえ、windowオブジェクトのonerrorイベントで True を返すようにする事で、標準のエラーダイアログが表示されないようになります。 ============= Form1 =========== Option Explicit Private WithEvents c As Class1 Private Sub c_onerror(ByVal description As Variant, ByVal URL As Variant, ByVal line As Variant, Handled As OLE_CANCELBOOL) Debug.Print description, URL, line Handled = True End Sub Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant) Set c = New Class1 Set pDisp.Document.parentWindow.onerror = c End Sub Private Sub Command1_Click() Me.WebBrowser1.Navigate2 "c:\test.html" End Sub ============= Class1 =========== Option Explicit Public Event onerror( _ ByVal description As Variant, _ ByVal URL As Variant, _ ByVal line As Variant) '[ツール]-[プロシージャ属性]で、このFunctionのプロシージャIDを '『(既定値)』に変更しておいてください。 Public Function onerror( _ ByVal description As Variant, _ ByVal URL As Variant, _ ByVal line As Variant) As Variant RaiseEvent onerror(description, URL, line) onerror = True End Function
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.