Writing a Windows Printer Driver

前端 未结 2 1720
滥情空心
滥情空心 2020-12-08 05:26

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 pri

相关标签:
2条回答
  • 2020-12-08 06:00

    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.

    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.

    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?

    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.

    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.

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

    0 讨论(0)
  • 2020-12-08 06:09

    I'm not sure about it to be displayed in the list but I've never tried this C++ code:

    #include <fstream>
    Namespace Drivers{
    Class Printer{
    Const IOStream Printer("PRN");
    Void Send(char a[]){
    Printer<<a;}
    Char GetStatus[](){
    Char a[];
    Printer>>a; 
    return a;
     };
     }
    
    0 讨论(0)
提交回复
热议问题