01-13-2009, 03:54 PM
Hi,
my aim was to use a function to create an IE object, then identify hwnd property to send it to the calling script for other functions. The use of runutility ie.explore is not exactly right for me, because my browser must have a certain website pre-imposted, so if i had already opened a browser and i wanted to open another browser, with runutility i would have problems to recognize new browser (i use the name/title property to recognize the browser). Howewer, I have found the solution with a function like this:
bye
my aim was to use a function to create an IE object, then identify hwnd property to send it to the calling script for other functions. The use of runutility ie.explore is not exactly right for me, because my browser must have a certain website pre-imposted, so if i had already opened a browser and i wanted to open another browser, with runutility i would have problems to recognize new browser (i use the name/title property to recognize the browser). Howewer, I have found the solution with a function like this:
Code:
Function FunOpenBrowser()
dim objexpl, brow, pag, hwnd(1)
set objexpl = CreateObject("InternetExplorer.Application")
objexpl.visible = true
objexpl.navigate "http://www.google.it"
wait(5)
Set brow = Browser("hwnd:=" & objexpl.hwnd)
Set pag = brow.Page("title:=" & objexpl.Document.Title)
brow.sync
wait(5)
hwnd(0) = brow.getroproperty("hwnd")
hwnd(1) = pag.getroproperty("hwnd")
Reporter.ReportEvent 0, "FunOpenBrowser", "hwnd browser: " & hwnd(0) & vbcr & " hwnd page: " & hwnd(1)
FunOpenBrowser = hwnd
Set objexpl = nothing
End Function
bye