SUMMARYSection 12.4 of the Microsoft Windows version 3.1 Software Development Kit (SDK) "Guide to Programming" details code that uses BitBlt() to transfer a bitmap to a printer device context (DC). Unfortunately, the code sample uses LoadBitmap(), which returns a Device-Dependent Bitmap (DDB) that is compatible with the display DC, not the printer DC. This code causes erroneous results on some printers. MORE INFORMATION
Because the sample code does not implement banding [it is using
StartPage() and EndPage()--the Windows 3.1 replacement functions for the NEWFRAME Escape], this code should work fine on banding devices such as Hewlett-Packard (HP) LaserJet or dot-matrix printers. When an application does not perform banding and is printing to a banding
device, GDI uses a disk-based metafile to perform banding on the
application's behalf. As the application makes GDI calls, the calls
are recorded into the metafile rather than being sent directly to the
printer. When the application calls EndPage (or NEWFRAME), GDI enters
an internal banding loop. GDI performs NEXTBAND escapes as needed and
uses PlayMetaFile() to play the entire metafile into every band.
During the playback of the metafile, GDI converts the DDB to a
Device-Independent Bitmap (DIB) and prints the DIB by calling
SetDIBitsToDevice(). Because of the DDB-to-DIB conversion, the code
works correctly on banding devices.
DIBVIEW can be found in the SAMPLES directory of the Windows SDK version 3.1, and versions 7.0 and 8.0 of the Microsoft C/C++ Optimizing Compiler. For Microsoft OnLine customers, DIBVIEW is available in the Microsoft Software Library as 5X13.ZIP and can be found by searching on the word DIBVIEW. Additional query words: 3.10 banding gp-fault gpf docerr
Keywords : kbdocfix kb16bitonly kbDSupport kbSDKWin16 |
Last Reviewed: July 2, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |