get Handle from a launched IE browser
Does anyone have a way that I can get the handle from an IE browser launched from my vb application?
I want to be able to check if that handle is present in windows later. See if the browser is still open. So I can send data to the internet explorer browser if need be based on the handle.
Thank you very much in advance for your time and consideration,
Mark
Re: get Handle from a launched IE browser
Re: get Handle from a launched IE browser
This api may do what you want :
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
If the function succeeds, the return value is the instance handle of the application that was run, or the handle of a dynamic data exchange (DDE) server application.
This information is from the Api-Guide software : http://www.mentalis.org/
Re: get Handle from a launched IE browser
What if I have to launch the application like this :
RetVal = Shell(sBrowser & " " & wurl, vbNormalFocus)
When sBrowser is the location of iexplorer.exe. The RetVal of this is a 4 digit number. When I use IsWindow to find it. It turns up false because the handle is incorrect.
I can't seem to get this to work, I tried several things but this does not launch the browser :
RetVal = ShellExecute(FMain.hwnd, "", "iexplore.exe", "www.yahoo.com", "C:\Program Files\Internet Explorer", 0)
Re: get Handle from a launched IE browser
The handle of the main IE window. The client area I do not need, at least not now. I need the handle of the main IE window to see if its still present and then pass it different addresses to go to. If the browser window is not there I will open another and then pass in the address. Basically we have an application when the user gets a phone call we have images stored on a local intranet that can be brought up once we send the browser an address. We don't want to keep opening new browser instances everytime they need to look at an image.
Re: get Handle from a launched IE browser
try this simple code
shell("start http://www.cisindia.net")
Hope that helps