CString param;
param.Format(_T("/t %s"),sFilePath);
SHELLEXECUTEINFO ShExecInfoPrintf = {0};
ShExecInfoPrintf.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfoPrintf.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfoPrintf.hwnd = NULL;
ShExecInfoPrintf.lpVerb = NULL;
ShExecInfoPrintf.lpFile = _T("AcroRd32"); //此处是待打印的 pdf文档
ShExecInfoPrintf.lpParameters = param;
ShExecInfoPrintf.lpDirectory = NULL;
ShExecInfoPrintf.nShow = SW_HIDE;
ShExecInfoPrintf.hInstApp = NULL;
ShellExecuteEx(&ShExecInfoPrintf); //可添加 bool变量,判断是否成功。
if (WaitForSingleObject(ShExecInfoPrintf.hProcess,5000) == WAIT_TIMEOUT)
{
TerminateProcess(ShExecInfoPrintf.hProcess,0);
}
//命令行参数
/n |
Start a separate instance of Acrobat or Adobe Reader, even if one is currently open.
|
/s | |
/o | |
/h |
Start Acrobat or Adobe Reader in a minimized window.
|