编写Windows打印机驱动程序 [英] Writing a Windows Printer Driver

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

问题描述

我想用C ++或C#编写一个应用程序,安装后将充当打印机驱动程序。它会在打印对话框的下拉列表中提供,但不是打印而是会调用我的代码。

I want to write a application in C++ or C# that will behave as a printer driver when installed. It will be available in the drop down list in Print dialog but instead of printing it will call into my code.

我认为Windows可能提供了一些编写接口打印机驱动程序。

I think there may be some interfaces that Windows provide to write printer drivers.

推荐答案

Windows提供了许多接口。您知道要编写哪种打印机驱动程序吗?当前,Windows支持三种类型的打印机驱动程序-PostScript,Unidrv和XPSDrv(后者仅在带有EP 1.0或更高版本的XP / 2003 Server上使用)。在大多数情况下,只需编写驱动程序插件即可。阅读INF体系结构以了解已安装这些东西,特别是有关微型驱动程序的部分。

Windows provides loads of interfaces. Do you know what sort of a printer driver you want to write? At present, Windows supports three flavors of printer drivers -- PostScript, Unidrv and XPSDrv (the latter on XP/2003 Server with EP 1.0 and upwards only). Most of the time, it suffices to write a driver plug-in instead. Read up on INF architecture to know these things get installed, specially the section on minidrivers.

如建议的那样,您将需要WDK能够构建驱动程序或其插件。请注意,驱动程序不使用Visual Studio IDE或编译器。 WDK带有自己的编译器。您可以始终将后者与VS连接起来,但这是另一回事。

As suggested, you will need the WDK to be able to build a driver or a plug-in thereof. Note that drivers do not use the Visual Studio IDE or compilers. The WDK comes with a compiler of its own. You can always hook up the latter with VS, but that's a different story.

WDK具有针对不同OS-es的设置。您将必须知道要处理的操作系统(或一组OS-es)并选择适当的设置。

The WDK has setups to target different OS-es. You will have to know which OS (or set of OS-es) you want to address and choose the appropriate setup.


我要编写一个简单的驱动程序,该驱动程序将显示在打印机列表中。

I want to write a simple driver that will displays in the list of printers.

我不认为这会有所帮助。如果要编写驱动程序,为什么要列出系统上所有其他驱动程序的列表?

I don't see how that will be helpful. If you are writing a driver, why would you want a list of all other drivers present on the system?


打印到该驱动程序将调用到我的代码中,这样我就可以进行诸如创建文档的PDF,调用Web服务等工作。

Printing to this driver will call into my code so that I can do stuff like create a PDF of the document, calling the Web Service etc.

有趣!您可以在UI插件中实现所有这些功能。 UI插件是一个dll,当您选择 Advanced 驱动程序属性时,该dll将被加载。

Interesting! You can achieve all those things in a UI plug-in. An UI plug-in is a dll that is loaded when you select the Advanced driver properties.

要开始使用UI插件,请查看WDK中的示例 oemui 源代码。

To get started with UI plug-ins take a look at the sample oemui source code in the WDK.

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

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