void Utility::runDosCmdAndWait(CString command, int maxWaitMS, CString path, int isShow)
{
CString final_cmd = _T(" /C
") + command;
SHELLEXECUTEINFO ShExecInfo
= { 0 };
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = _T("cmd");
ShExecInfo.lpParameters = final_cmd;
ShExecInfo.lpDirectory = path;
ShExecInfo.nShow = isShow;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
WaitForSingleObject(ShExecInfo.hProcess, maxWaitMS);
}
沒有留言:
張貼留言