Option Explicit Public WithEvents hDoc As MSHTML.HTMLDocument Private Function hDoc_oncontextmenu() As Boolean '"disable" the context menu hDoc_oncontextmenu = False End Function
Option Explicit Dim colDocs As Collection Private Sub Form_Load() Set colDocs = New Collection 'browse to you favorite web site WebBrowser1.Navigate ("http://www.vbfrance.com/forum/sujet-EMPECHER-CLIC-DROIT-SUR-WEBROWSER_1493085.aspx";) End Sub 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 cDoc As clsDoc 'clean the collection, then re-instanciate Set colDocs = Nothing Set colDocs = New Collection 'new instance of our document class referencing the current document Set cDoc = New clsDoc Set cDoc.hDoc = pDisp.Document 'add it to the collection colDocs.Add cDoc End Sub Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant) Dim cDoc As clsDoc 'new instance of our document class referencing the new document Set cDoc = New clsDoc Set cDoc.hDoc = pDisp.Document 'add it to the collection colDocs.Add cDoc End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question