SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = _T("E:\\Users\\kd\\Desktop\\向天再借五百年.txt"); //要运行的文件
ShExecInfo.lpParameters = _T("");
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
DWORD dwId = 0L;
if (ShellExecuteEx(&ShExecInfo))
{
dwId = ::GetProcessId(ShExecInfo.hProcess);
}
CString csId(_T(""));
csId.Format(_T("%d"), dwId);
AfxMessageBox(csId);
获取ShellExecuteEx执行后的进程pid
最新推荐文章于 2021-07-30 15:42:51 发布