문제

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 ?

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.

도움이 되었습니까?

해결책

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.

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

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top