您的位置:首页 > 其它

VC 命令行打印PDF文件

2012-06-08 14:27 330 查看
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);
}


//命令行参数

Option
Meaning
/n

Start a separate instance of Acrobat or Adobe Reader, even if one is currently open.
/s

Suppress the splash screen.
/o

Suppress the open file dialog box.
/h

Start Acrobat or Adobe Reader in a minimized window.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: