应用ShellExecute等待另一进程终止

类别:VC语言 点击:0 评论:0 推荐:
   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);
   }

本文地址:http://com.8s8s.com/it/it298.htm