#1
|
|||
|
|||
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. |
#2
|
|||
|
|||
The process did exist, but only for a brief amount of time. It detected a previously running instance of Firefox (through a Mutex, for instance), sent some sort of message (SendMessage, DDE, ...) telling it to open the intended page, and terminated.
What you'd need is for that second process to wait until the page handled in the main process closes. Or better yet, for that second Firefox copy to open the page itself, and in that case you would detect when it has closed. Unfortunately, for both of these cases you are totally dependent on the program's code, and browsing the forums I didn't find any indication that this can be done . Maybe you can have a better look ... |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
What is wrong? | Asus | General Discussion | 2 | 11-14-2006 18:41 |
Armadillo 3.50a giving trouble | Flagmax | General Discussion | 6 | 01-05-2005 00:15 |
what's wrong? | droptionno_1 | General Discussion | 2 | 08-27-2002 04:41 |