编程设置打印机绕过Windows后台处理程序 [英] Programmatically set printer to bypass the windows spooler

查看:279
本文介绍了编程设置打印机绕过Windows后台处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法以编程方式配置,打印到文件(本地文件端口)的打印机绕过后台服务,数据直接发送到文件?

Is there a way to programmatically configure a printer that prints to a file (local file port) to bypass the spooler service and send the data directly to the file ?

我看了@ prnadmin.dll(没有相关那里)和WMI(没有相关的)。有任何想法吗 ?不,我不想停止Print Spooler服务在Windows(XP SP3),就使打印机绕过它。

I have looked @ prnadmin.dll (nothing relevant there) and WMI (nothing relevant). Any ideas ? And no, I don't want to stop the print spooler service in Windows (XP SP3), just make the printer bypass it.

推荐答案

PRINTER_INFO_2结构有一个名为PRINTER_ATTRIBUTE_DIRECT参数。可以使用OpenPrinter获取句柄到打印机上,得到这个结构,改变属性(请确保您按位与它让你不改变任何现有的其他属性),然后做这种改进结构的SetPrinter。

The PRINTER_INFO_2 structure has a parameter called PRINTER_ATTRIBUTE_DIRECT. You can get the handle to the printer using OpenPrinter, get this structure, change the attribute (make sure you bitwise AND it so that you dont change any of the other existing attributes) and then do a SetPrinter with this modified structure.

请参阅此链接了解如何使用SetPrinter。 http://support.microsoft.com/kb/140285

Refer to this link to see how you can use SetPrinter. http://support.microsoft.com/kb/140285

希望这有助于。如果是这样,请投票+1的答案:)

Hope this helps. If so, please vote a +1 for the answer :)

这篇关于编程设置打印机绕过Windows后台处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆