|
CreateProcess giving wrong ProcessID/ThreadID
I currently have the following problem:
I'm coding an application which shows the user a HTML "readme" and does not continue until the user closes the window again. To do this, I get the default browser, execute it by "CreateProcess" with the HTML file as parameter and wait for the process to exit.
While this works fine when "Internet Explorer" is the default browser, it doesn't work with "Firefox" in some situations.
If a copy of IE is already running, a call to CreateProcess will create a second process and return the correct ProcessHandle and ProcessID in the PROCESS_INFORMATION structure passed to CreateProcess.
However if there is already one open Firefox window, the new window will get opened from the already running process and CreateProcess will fill the PROCESS_INFORMATION structure with some values, but as far as I can tell, the process they should belong to never existed.
Now I don't know how to check when the users closes the window my application opened, since the ProcessHandle and ProcessID returned from CreateProcess are worthless. I don't want to use any "FindWindow" calls, since it would practically lock myself to Firefox, since Internet Explorer works fine with the method explained below.
|