进程问题? - C++ Builder / Windows SDK/API
我在程序中调用Word程序,如何等到Word程序结束后,再把操作权交给主程序呢?也就是说要等Word进程结束后再执行主程序下面的代码.
[解决办法]
用 WaitForSingleObject;
如:
PROCESS_INFORMATION pi;
STARTUPINFO si;
ZeroMemory(&si,sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
CreateProcess(NULL, "E:\\Program Files\\Microsoft Office\\Office\\WINWORD.EXE ",NULL,NULL,TRUE,NULL,NULL,NULL,&si,&pi);
WaitForSingleObject(pi.hProcess,INFINITE);