应用 ShellExecute 等待另一进程终止

SHELLEXECUTEINFO exeInfo;
   exeInfo.cbSize = sizeof(SHELLEXECUTEINFO);
   exeInfo.fMask = (SEE_MASK_DOENVSUBST|SEE_MASK_FLAG_DDEWAIT|0x04000000|SEE_MASK_NOCLOSEPROCESS|SEE_MASK_NO_CONSOLE);
   exeInfo.hwnd = NULL;
   exeInfo.lpVerb = "open";
   exeInfo.lpFile = (LPCTSTR)路径&文件名;
   exeInfo.lpParameters = NULL;
   exeInfo.lpDirectory = NULL;
   exeInfo.nShow = SW_SHOWNORMAL;
   exeInfo.hInstApp = NULL;
   exeInfo.lpIDList = NULL;
   exeInfo.lpClass = NULL;
   exeInfo.hkeyClass = NULL;
   exeInfo.dwHotKey = NULL;
   exeInfo.hMonitor = NULL;
   exeInfo.hIcon = NULL;
   exeInfo.hProcess = NULL;
  
   ::ShellExecuteEx(&exeInfo);
   if(exeInfo.hProcess)
   {
     ::WaitForSingleObject(exeInfo.hProcess,INFINITE);
     ::CloseHandle(exeInfo.hProcess);
   }

你可能感兴趣的:(应用 ShellExecute 等待另一进程终止)