首页
社区
课程
招聘
[求助]请问如何能等待CreateProcess调用explorer创建的winword.exe进程的退出事件?
发表于: 2016-1-22 17:18 3745

[求助]请问如何能等待CreateProcess调用explorer创建的winword.exe进程的退出事件?

2016-1-22 17:18
3745
我想要的效果是能等待到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);

[课程]Linux pwn 探索篇!

收藏
免费 0
支持
分享
最新回复 (2)
雪    币: 209
活跃值: (138)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
加入一个job之中,有相关的事件
2016-1-22 18:23
0
雪    币: 206
活跃值: (300)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
麻烦说详细点,谢谢了
2016-1-22 20:40
0
游客
登录 | 注册 方可回帖
返回
//