How To Call GDI Functions from a Print Driver

Last reviewed: March 11, 1997
Article ID: Q151891
4.00 WINDOWS 95 kbprg kbprint kbhowto

The information in this article applies to:

  • Microsoft Windows 95 Device Driver Kits (DDK)

SUMMARY

A print driver can call GDI functions having the same name as printer- driver entry-point functions by explicitly or implicitly reloading GDI.

MORE INFORMATION

Windows 95 printer drivers export functions that have the same name as the GDI functions. In order to call the GDI functions from a printer driver, such as BitBlt, ExtTextOut, etc., do the following:

  1. Import the GDI functions in the .DEF file under the IMPORTS section of the driver's .DEF file and use the imported function names.

  2. Do a LoadLibrary on GDI.EXE and obtain the address of the desired function to be called using the GetProcAddress function. Once the address is obtained, the function can be called using the function pointer.

  3. Define a DLL with functions that will call the GDI functions and IMPORT the DLL functions in the printer driver. For example, to call a GDI function, you would call the corresponding function in the DLL that, in turn, would make the GDI function call.


Additional reference words: debugging print driver
KBCategory: kbprg kbprint kbhowto
KBSubcategory: DDK DDKPRNT
Keywords : DDK DDKPRNT kbhowto kbprg kbprint
Version : 4.00
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 11, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.