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
%IDC_Button = 1002
Global hDlg, hBrowser As Dword
Function PBMain
Local pWindow As IWindow, bstrURL As WString
Dialog New Pixels, 0, "WebBrowser", , , 300, 200, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, %IDC_Button, "Get Inner Text",10,10,75,25
pWindow = Class "CWindow"
bstrURL = "MSHTML:<HTML><BODY><table><tr><td>Beene</td><td>Apr</td></BODY></HTML>"
' bstrURL = "MSHTML:<HTML><BODY><table><tr><td>Beene</td> <td>Apr</td></BODY></HTML>"
hBrowser = pWindow.AddWebBrowserControl(hDlg, %IDC_WEBBROWSER, bstrURL, Nothing, 5, 40, 600,360)
Dialog Show Modal hDlg, Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local pIWebBrowser2 As IWebBrowser2
Local pIHTMLDocument2 As IHTMLDocument2
Local pElement As IHTMLElement
Local temp$$
Select Case CbMsg
Case %WM_Command
Select Case Cb.Ctl
Case %IDC_Button
pIWebBrowser2 = OC_GetDispatch(hBrowser)
pIHTMLDocument2 = pIWebBrowser2.Document
pElement = pIHTMLDocument2.body
temp$$ = pElement.innerText
MsgBox temp$$, %MB_Ok, "Inner Text"
End Select
Case %WM_Size
If Cb.WParam <> %Size_Minimized Then
Local w,h As Long
Dialog Get Client Cb.Hndl To w,h
Control Set Size Cb.Hndl, %IDC_WebBrowser, w-10, h-50
End If
End Select
End Function
'gbs_01327
'Date: 05-11-2013
http://www.garybeene.com/sw/gbsnippets.htm