Hi everyone,
I had create a gui program to call another exe file, therefore I am wondering is there anyway to keep track on the executed program so that when the user cancel it I can cancel my parent program as well.
Hi everyone,
I had create a gui program to call another exe file, therefore I am wondering is there anyway to keep track on the executed program so that when the user cancel it I can cancel my parent program as well.
Start the program using ShellExecuteEx or CreateProcess to attain a process handle.
You can then check the handle using WaitForSingleObject with a wait of 0 to see if handle is signaled or not. If WaitForSingleObject returns WAIT_OBJECT_0, it means the process is still running, and if it returns WAIT_TIMEOUT, it means the program has finished executing (in this case, you should also call CloseHandle on that handle, as well).
Or you can specify a longer wait if you want, since the app won't consume cpy cycles when it's waiting.
Last edited by Elysia; 11-30-2007 at 02:53 AM.