gpt4 book ai didi

c++ - 如何提供 XPS 文件路径作为本地端口?

转载 作者:行者123 更新时间:2023-11-30 05:23:28 24 4
gpt4 key购买 nike

下面是我正在尝试的代码片段:

PRINTER_INFO_2 pi;
BOOL Result = FALSE;
HANDLE pHd;

memset(&pi, 0, sizeof(PRINTER_INFO_2));
pi.pPrinterName = L"RxXPSDrv";
pi.pDriverName = L"XPSDrv Sample Driver";
// Select Share Name
pi.pShareName = L"MyPrinter";
// Select Server Name
pi.pServerName = NULL;

// Select Port Name
pi.pPortName = L"COM3:";
//pi.pPortName = L"C:\\Users\\admin\\Desktop\\a1.xps";

pi.pSecurityDescriptor = NULL;
// Select Print Processor
pi.pPrintProcessor = L"winprint";
// Select Attributes
pi.Attributes = PRINTER_ATTRIBUTE_DO_COMPLETE_FIRST | PRINTER_ATTRIBUTE_LOCAL;
// Set Priority
pi.Priority = 1;
// Call the function AddPrinter
pHd = AddPrinter(NULL, 2, (LPBYTE)&pi);

这里@pi.pPortName 我需要提供C:\Users\admin\Desktop\a1.xps 但它不工作而且打印机没有被添加.使用 COM3 它工作正常。谁能告诉我我该怎么做?如何提供 XPSpi.pPortName 的完整路径?

最佳答案

您必须先添加一个“本地端口”“C:\Users\admin\Desktop\a1.xps”。我刚试过,它奏效了。添加端口的一些代码:Adding-a-Local-Port-through-XcvData-and-C

关于c++ - 如何提供 XPS 文件路径作为本地端口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39163904/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com