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?
Printable View
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?
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.
MS says the HINSTANCE set is not really an HINSTANCE, it's error handling.
Well...you would not use the 'hInstApp' member of the "SHELLEXECUTEINFO' structure but rather the 'hProcess ' one... ;)Quote:
Originally Posted by NoHero
However, this still depends on several options you can set within the 'SHELLEXECUTEINFO' structure and thus, isn't reliable.
Quote:
Originally Posted by aewarnick
Thanks, I had it working but it looks like CreateProcess is much more reliable.