Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compile Exe
#Dim All
%Unicode = 1
%UseWebBrowser = 1 ' // Use the WebBrowser control
#Include Once "CWindow.inc" ' // CWindow class
%IDC_WebBrowser = 1001
Function PBMain
Local hDlg As Dword, pWindow As IWindow, pWBEvents As DWebBrowserEvents2Impl
Dialog New Pixels, 0, "WebBrowser", , , 600, 400, %WS_OverlappedWindow To hDlg
pWindow = Class "CWindow"
pWBEvents = Class "CDWebBrowserEvents2"
pWindow.AddWebBrowserControl(hDlg, %IDC_WEBBROWSER, "http://www.powerbasic.com", pWBEvents, 0, 0, 600,400)
Dialog Show Modal hDlg, Call DlgProc
End Function
CallBack Function DlgProc() As Long
End Function
Class CDWebBrowserEvents2 As Event
Interface DWebBrowserEvents2Impl $IID_DWebBrowserEvents2 As Event
Inherit IDispatch
Method DocumentComplete <259> ( ByVal pDisp As IDispatch, ByRef vURL As Variant)
Local pIWebBrowser2 As IWebBrowser2
Local pIHTMLDocument2 As IHTMLDocument2
Local temp$
' // Get a reference to the IWebBrowser2 interface
pIWebBrowser2 = pDisp
If IsNothing(pIWebBrowser2) Then Exit Method
' // Get a reference to the active document
pIHTMLDocument2 = pIWebBrowser2.Document
If IsNothing(pIHTMLDocument2) Then Exit Method
temp$ = pIHTMLDocument2.body.innerText
If Len(temp$) = 0 Then Exit Method
? "document loaded"
End Method
End Interface
End Class
'gbs_01312
'Date: 05-11-2013
http://www.garybeene.com/sw/gbsnippets.htm