bool execwait(char *cmdline,char *cmd,int timeout)
{
PROCESS_INFORMATION pi;
STARTUPINFO si;
ZeroMemory( &pi, sizeof(pi) );
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
CreateProcess(cmdline,cmd,NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
WaitForSingleObject(pi.hProcess ,timeout);
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
return true;
}
执行函数execwait(NULL,lpCmd,120000)
最新推荐文章于 2023-11-12 18:54:21 发布