Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CreateProcess question

Status
Not open for further replies.

Baal80

Programmer
Aug 14, 2004
14
PL
Hello, I have a following problem. My app starts an external app (code is shown below), and waits for it to finish. That's OK but sometimes this external app launches *its* child app and terminates itself. How can I determine if this "child-app" (launched by external app) had finished execution? Particularly, I launch a deinstaller but this deinstaller launches a main deinstaller and terminates - my program doesn't wait for the main deinstaller to finish - I'd like to know if it's possible.
ANY help would be greatly appreciated, as I've searched the net for a solution and found nothing :(

My sample code for launching external app looks like this:

STARTUPINFO StartInfo;
PROCESS_INFORMATION ProcInfo;
memset(&ProcInfo, 0, sizeof(ProcInfo));
memset(&StartInfo, 0 , sizeof(StartInfo));
StartInfo.cb = sizeof(StartInfo);

if (FileExists(deinstaller.c_str())==true)
{
int res = CreateProcess(deinstaller.c_str(), params.c_str(), NULL, NULL, NULL, NULL, NULL, NULL, &StartInfo, &ProcInfo);

if (res)
{
WaitForSingleObject(ProcInfo.hThread, INFINITE);
CloseHandle(ProcInfo.hProcess);
}
}
 
Instead of using WaitForSingObject have you looked at using MsgWaitForMultipleObjects?

James P. Cottingham
-----------------------------------------
To determine how long it will take to write and debug a program, take your best estimate, multiply that by two, add one, and convert to the next higher units.
 
I read about it but how to "transport" information about handles created by the external app to my program (some kind of array of handles I think)? Unfortunately I'm a newbie in this matter :(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top