Date: 02-16-2022
Return to Index
created by gbSnippets
Node http://msdn.microsoft.com/en-us/ie/hh869750%28v=vs.80%29
Element http://msdn.microsoft.com/en-us/ie/hh869681%28v=vs.80%29
HtmlElement http://msdn.microsoft.com/en-us/ie/hh869697%28v=vs.80%29
IWebBrowser2 http://msdn.microsoft.com/en-US/library/ee487824%28v=winembedded.60%29.aspx
IHTMLDocument2 http://msdn.microsoft.com/en-us/library/aa752127%28v=vs.85%29.aspx
IHTMLDocument3
IHTMLElementCollection
IHTMLElement
%UNICODE = 1
%USEWEBBROWSER = 1 ' // Use the WebBrowser control
#Include Once "CWindow.inc" ' // CWindow class
Local pWindow As IWindow 'CWINDOW CLASS - Create an instance of the CWINDOW class
Local pWBEvents As DWebBrowserEvents2Impl 'EVENT CLASS - Create an instance of the event class
pWindow = Class "CWindow"
pWBEvents = Class "CDWebBrowserEvents2"
Local bstrURL As WString
bstrURL = "http://www.powerbasic.com/support/pbforums/index.php"
hBrowser = pWindow.AddWebBrowserControl(hDlg, %IDC_WEBBROWSER, bstrURL, pWBEvents, 600,350, nWide, nHigh)
Local pIWebBrowser2 As IWebBrowser2 'webbrowser control default interface
Local pIHTMLDocument2 As IHTMLDocument2
Local pIHTMLDocument3 As IHTMLDocument3
Local Elems As IHTMLElementCollection
Local E As IHTMLElement
Local Img As IHTMLImgElement
'enumerate links
tmp$$ = "a" 'in this example, find anchor tags
pIWebBrowser2 = OC_GetDispatch(hBrowser) 'reference to webbrowser control default interface
pIHTMLDocument2 = pIWebBrowser2.Document
pIHTMLDocument3 = pIHTMLDocument2
Elems = pIHTMLDocument3.GetElementsByTagName(tmp$$)
For i = 0 To Elems.Length - 1 'zero based element count
pDispatch = Elems.item(i,i)
E = pDispatch
tmp$$ = E.toString
temp$ = temp$ + $CrLf + tmp$$
Next i
'text range from selection
Local pIHTMLSelectionObject As IHTMLSelectionObject
Local pDispatch As IDispatch
Local pIHTMLTxtRange As IHTMLTxtRange
pIHTMLSelectionObject = pIHTMLDocument2.selection
pDispatch = pIHTMLSelectionObject.createRange
pIHTMLTxtRange = pDispatch
'gbs_01378
'Date: 10-17-2014
http://www.garybeene.com/sw/gbsnippets.htm