|
-
September 22nd, 2004, 02:23 PM
#1
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
-
September 23rd, 2004, 07:56 AM
#2
Re: get Handle from a launched IE browser
-
September 23rd, 2004, 09:14 AM
#3
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/
-
September 23rd, 2004, 11:12 AM
#4
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)
-
September 23rd, 2004, 11:42 AM
#5
Which handle?
Do you want the handle of the main IE window (i.e.including title bar) or the handle of the client area (i.e. the area in which page is loaded)?
-
September 23rd, 2004, 02:28 PM
#6
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.
-
September 23rd, 2004, 10:37 PM
#7
FindWindow
FindWindow can be used to find a window with classname as IEFrame. This will give the handle of the main IE window. But it will work only if one browser window is open at a time. Otherwise also, you will get a handle of an IE window, but it may not be the window that you want.
-
September 23rd, 2004, 11:18 PM
#8
Re: get Handle from a launched IE browser
try this simple code
shell("start http://www.cisindia.net")
Hope that helps
-
September 24th, 2004, 06:36 AM
#9
Re: FindWindow
 Originally Posted by avinash_sahay
FindWindow can be used to find a window with classname as IEFrame. This will give the handle of the main IE window. But it will work only if one browser window is open at a time. Otherwise also, you will get a handle of an IE window, but it may not be the window that you want.
What if I use IsWindow(hwnd as long, etc, etc) won't it always look to find the window with that handle regardless if there are more IExplorer browser's open?
 Originally Posted by cancer10
try this simple code
shell("start http://www.cisindia.net")
Hope that helps
I can't get that code to work in VB6. But this does work
RetVal = Shell(sBrowser & " " & wurl, vbNormalFocus)
where sBrowser is the full path of your internet explorer.exe and wurl is the url you want to display. I just want the handle of that window that I am launching.
 Originally Posted by Heulsay
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.
I just can't get that to launch the browser. But it looks like if I had the handle of an already open browser then I could pass it commands?
Last edited by Mark_Lane; September 24th, 2004 at 06:43 AM.
-
September 24th, 2004, 09:40 PM
#10
Re: FindWindow
 Originally Posted by Mark_Lane
What if I use IsWindow(hwnd as long, etc, etc) won't it always look to find the window with that handle regardless if there are more IExplorer browser's open?
I can't get that code to work in VB6. But this does work
My above said code will not work if u r on any NT based windows like 2000, XP, 2003, NT 4.0, etc
-
September 27th, 2004, 06:58 AM
#11
Re: FindWindow
 Originally Posted by cancer10
My above said code will not work if u r on any NT based windows like 2000, XP, 2003, NT 4.0, etc
Okay, thanks for the response! Which platforms will it work on ... for anyone browsing this forum who may be curious?
-
September 27th, 2004, 09:03 AM
#12
Re: FindWindow
 Originally Posted by Mark_Lane
Okay, thanks for the response! Which platforms will it work on ... for anyone browsing this forum who may be curious?
It will work on 95/98/98SE/ and Mellinuim
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|