经验收集

怎么把GUID转换成CString

const GUID _tlid =  { ... };
....
....

CComBSTR tmp(_tlid);
CString csGuid(tmp);

 

等待ShellExecuteEx执行完成

SHELLEXECUTEINFO lpExecInfo;
      lpExecInfo.cbSize  = sizeof(SHELLEXECUTEINFO);
      lpExecInfo.lpFile = AdobeAcrobat // name of file that you want to execute/ print/ or open/ in your case Adobe Acrobat.
lpExecInfo.fMask=SEE_MASK_DOENVSUBST|SEE_MASK_NOCLOSEPROCESS ;     
      lpExecInfo.hwnd = NULL;  
      lpExecInfo.lpVerb = "open"; // to open  program
      lpExecInfo.lpParameters = fileName; //  file name as an argument
      lpExecInfo.lpDirectory = NULL;   
      lpExecInfo.nShow = SW_SHOW ;  // show command prompt with normal window size 
      lpExecInfo.hInstApp = (HINSTANCE) SE_ERR_DDEFAIL ;   //WINSHELLAPI BOOL WINAPI result;
      ShellExecuteEx(&lpExecInfo);
    
     
      //wait until a file is finished printing
      if(lpExecInfo.hProcess !=NULL)
      {
        ::WaitForSingleObject(lpExecInfo.hProcess, INFINITE);
        ::CloseHandle(lpExecInfo.hProcess);
      }

你可能感兴趣的:(经验)