void createchildprocessandwaituntildone(const ansistring& strcmdline) {
process_information piprocinfo; startupinfo sistartinfo;
// set up members of startupinfo structure. sistartinfo.cb = sizeof(startupinfo); sistartinfo.lpreserved = null; sistartinfo.lpreserved2 = null; sistartinfo.cbreserved2 = 0; sistartinfo.lpdesktop = null; sistartinfo.dwflags = 0;
// create the child process. createprocess(
null, strcmdline.c_str(), null, // process security attributes null, // primary thread security attributes 0, // handles are inherited 0, // creation flags null, // use parent\'s environment null, // use parent\'s current directory &sistartinfo, // startupinfo pointer &piprocinfo); // receives process_information
// wait for the processs to finish dword rc = waitforsingleobject( piprocinfo.hprocess, // process handle infinite); } |