如何创建自己的XP打印机驱动程序 [英] How to create own XP printer driver

查看:115
本文介绍了如何创建自己的XP打印机驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将如何创建自己的XP打印机驱动程序,该驱动程序将执行以下操作:

How would I create my own XP printer driver which will do the following:


  • 打印到文件(可能是XPS
    格式)

  • 将此文件放入受密码
    保护的ZIP文件

  • 通过电子邮件将其发送到配置的
    电子邮件地址

推荐答案

您需要的不是打印机驱动程序。一位叫打印监视器。它是一个DLL,它将在Spooler.exe进程中加载​​。 DLL在初始化阶段为假脱机程序提供了端口的逻辑名称,例如LPT1:,FILE:,SPSPort:等。使用打印机驱动程序准备的optput必须以任何方式发送到目标设备。这项工作不会打印标准TCP / IP端口或本地端口之类的监视器。

What you need is not a printer driver. One named it Print Monitor. It is a DLL, which will be loaded in Spooler.exe process. The DLL gives Spooler at the initialisation phase a logical names of ports like LPT1:, FILE:, SPSPort: etc. The optput prepared with a printer driver must be send in any way to a destination device. This work does print monitors like "Standard TCP/IP Port" or "Local Port".

要编写打印机监视器,您需要下载并安装Windows Driver Kit(WDK或某些时间之前的DDK请参见 http://www.microsoft.com/whdc/devtools/WDK /default.mspx )。有关编写打印机监视器的更多信息,请参见 http:// msdn .microsoft.com / en-us / library / ff563806(v = VS.85).aspx 。打印监视器是具有某些导出功能的DLL(请参见 http ://msdn.microsoft.com/zh-CN/library/ff549405(v = VS.85).aspx )。我建议您从修改本地监视器示例LocalMon开始,您可以在安装WDK后找到完整的源代码目录(请参阅 http://msdn.microsoft.com/en-us/library/ff556478(v = VS.85).aspx )。

To write printer monitor you need download and install Windows Driver Kit (WDK or some time ago DDK see http://www.microsoft.com/whdc/devtools/WDK/default.mspx). More information about writing printer monitor see http://msdn.microsoft.com/en-us/library/ff563806(v=VS.85).aspx. Print Monitor is a DLL with some exported function (see http://msdn.microsoft.com/en-us/library/ff549405(v=VS.85).aspx). I recomment you to start with modifying of Local Monitor example LocalMon which full source sode you find after installing of WDK (see http://msdn.microsoft.com/en-us/library/ff556478(v=VS.85).aspx).

编写打印机监视器的最实际问题是需要编写真正的多线程DLL。您必须非常小心,理解并在所有功能中使用 EnterCriticalSection 。为了调试打印机监视器,您应该将Visual Studio Debugger连接到进程后台处理程序。其余部分与运行标准Windows Win32 / Win64 DLL的编写相同。

The most practical problem with writing of printer monitor is requirement of writing a real multithreaded DLL. You must be very carefull, understand and use EnterCriticalSection in all you functions. For debugging of printer monitor you should connect Visual Studio Debugger to the process Spooler. The rest is the same as writing of a standard windows Win32/Win64 DLL running.

更新:还有一点小小的评论。如果您不希望打印机驱动程序对发送到打印机的数据执行任何操作,则可以使用通用打印机驱动程序。您将在名称为 Generic / Text Only的 Generic制造商的打印机下找到它。检查您拥有的一些驱动程序设置(例如CR LF设置)

UPDATED: One more small remark. If you don't want that the printer driver do anything with the data sent to the printer you can use generic printer driver. You will find it under "Generic" manufacture, printer with the name "Generic / Text Only". Examine some driver settings which you has (like CR LF settings)

这篇关于如何创建自己的XP打印机驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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