|
-
June 22nd, 2005, 01:55 PM
#1
Make my code wait or loop until another program closes
I am using ShellExecute to open a text file in notepad. I need to wait until notepad is close to continue with the execution of my program.
What do you think is the best way to do that?
-
June 22nd, 2005, 02:20 PM
#2
Re: Make my code wait or loop until another program closes
Use ShellExecuteEx to retrieve the HINSTANCE of the application and use Wait functions on it such as WaitForSingleObject(). Just wait INFINITE and the function will only return if the application was closed.
-
June 22nd, 2005, 02:32 PM
#3
Re: Make my code wait or loop until another program closes
MS says the HINSTANCE set is not really an HINSTANCE, it's error handling.
-
June 22nd, 2005, 02:47 PM
#4
Re: Make my code wait or loop until another program closes
 Originally Posted by NoHero
Use ShellExecuteEx to retrieve the HINSTANCE of the application and use Wait functions on it such as WaitForSingleObject(). Just wait INFINITE and the function will only return if the application was closed.
Well...you would not use the 'hInstApp' member of the "SHELLEXECUTEINFO' structure but rather the 'hProcess ' one... 
However, this still depends on several options you can set within the 'SHELLEXECUTEINFO' structure and thus, isn't reliable.
-
June 22nd, 2005, 02:49 PM
#5
Re: Make my code wait or loop until another program closes
 Originally Posted by aewarnick
What do you think is the best way to do that?
-
June 22nd, 2005, 05:17 PM
#6
Re: Make my code wait or loop until another program closes
Thanks, I had it working but it looks like CreateProcess is much more reliable.
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
|