Exetools  

Go Back   Exetools > General > General Discussion

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 11-05-2006, 00:20
MarkusO
 
Posts: n/a
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.
Reply With Quote
  #2  
Old 11-05-2006, 04:12
Mkz Mkz is offline
Friend
 
Join Date: Jan 2002
Posts: 98
Rept. Given: 0
Rept. Rcvd 2 Times in 2 Posts
Thanks Given: 5
Thanks Rcvd at 25 Times in 17 Posts
Mkz Reputation: 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 ...
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


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


All times are GMT +8. The time now is 20:10.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( 1998 - 2024 )