CreateProcess参数传递细节
bool CreateProcessTask(const CString& strETLPath)
{
STARTUPINFO sInfo;
PROCESS_INFORMATION pInfo;
ZeroMemory(&sInfo,sizeof(sInfo));
sInfo.cb=sizeof(sInfo);
sInfo.dwFlags=STARTF_USESHOWWINDOW;
sInfo.wShowWindow=SW_HIDE;
CString strToolExe = strETLPath;
strToolExe += _T(" ");
strToolExe += _T("\"");
strToolExe += m_strPipeNameI;
strToolExe += _T("\"");
strToolExe += _T(" ");
strToolExe += _T("\"");
strToolExe += m_strPipeNameO;
strToolExe += _T("\"");
//创建一个进程
BOOL bRet = ::CreateProcess(NULL,strToolExe.GetBuffer(),
NULL,
NULL,
FALSE,
CREATE_NEW_CONSOLE ,
NULL,
NULL,
&sInfo,
&pInfo);
if (bRet)
{
// 等待程序结束
WaitForSingleObject(pInfo.hProcess,INFINITE);
CloseHandle(pInfo.hProcess);
}
return true;
}

浙公网安备 33010602011771号