我想要的效果是能等待到explorer 打开的WINWROD.EXE进程退出的时候,谢谢。
目前的情况是测试程序退出了,即通过了WaitForSingleObject,但word进程却还在那里。
我想捕获的是word进程退出的事件,谢谢。
wstring Parm = L"explorer /open,C:\\Test.docx";
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));
si.dwFlags = si.dwFlags | STARTF_USESHOWWINDOW;
si.wShowWindow = SW_SHOWNORMAL;
CreateProcess(NULL, // No module name (use command line).
(WCHAR *)Parm.c_str(), // Command line. temp.GetBuffer()
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
0, // No creation flags. CREATE_NO_WINDOW
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi); // Pointer to PROCESS_INFORMATION structure.
// Wait until child process exits.
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!