使用winapi打印文档

时间:2013-05-23 15:34:01

标签: winapi printing

我正在将文档发送到默认打印机,在我的程序中执行shell,我很奇怪有没有winapi可以直接将文件发送到给定的打印机?

当前代码如下;

    SetDefaultPrinter((LPWSTR)"XXX Printer Name");
SHELLEXECUTEINFO shInfo = { 0 };
    shInfo.cbSize = sizeof(SHELLEXECUTEINFO);
    shInfo.lpFile = (LPCWSTR)"c:\\test.pdf"
    shInfo.lpVerb = (LPCWSTR)L"print";
    shInfo.dwHotKey = VK_SPACE;
    shInfo.nShow = SW_HIDE;
    result = ShellExecuteEx(&shInfo);

有其他选择吗?

0 个答案:

没有答案