|
-
Jun 28th, 2001, 05:06 PM
#1
Thread Starter
New Member
Help with WaitForSingleObject and internetexplorer
I'm having a problem using the internetexplorer webbrowser control with the WaitForSingleObject function. What I need to do, is to have my application open up a new Internet Explorer window in a new process using the internetexplorer control. Then after I get a process handle for the new IE window that I opened up, I need to pass this handle to the WaitForSingleObject function and wait until IE is closed by the user.
Currently the method I use to do this works fine if there are no other IE instances currently running, but if there are other IE instances running while my app creates a new internetexplorer object, then my new IE instance will use the same process as the other IE instance that was already running.
So basically my question is, how do I force the internetexplorer control to create a new process when the object is created? If that is impossible, then does anyone have any other suggestions for waiting for the new IE window to close?
Here is the code I am currently using for this:
Dim ieMain As InternetExplorer
Dim lPid As Long, hProcess As Long, lRet As Long, bRet As Boolean
Set ieMain = CreateObject("InternetExplorer.Application")
ieMain.Navigate "http://www.blahblahblah.com"
ieMain.Visible = True
'Sets lPid to the process id by passing in a window handle
Call GetWindowThreadProcessId(ieMain.hwnd, lPid)
'Returns a handle to the process id
hProcess = OpenProcess(SYNCHRONIZE, False, lPid)
lRet = WaitForSingleObject(hProcess, INFINITE)
bRet = CloseHandle(hProcess)
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
|