SAMPLE: WINCAP Captures Screens Using DIB APILast reviewed: August 5, 1996Article ID: Q97193 |
The information in this article applies to:
SUMMARYWINCAP demonstrates how to capture, save, and print the entire screen, portions of the screen, or specific windows. The program also defines routines that accomplish common device-independent bitmap (DIB) functions; these routines form the DIB application programming interface (API). WINCAP uses the DIB API functions for most of the screen capture, printing, and saving work. See the DIBAPI.TXT file for a description of the DIB API functions.
MORE INFORMATIONWINCAP illustrates the following techniques:
The preferred way to capture a screen in Microsoft(R) Windows(TM) is to copy the screen pixels into a DIB, and then to use this DIB in subsequent operations (for example, to save the bitmap to a file or print the bitmap). If you do not use a DIB in the intermediate step, the results of the screen print may be less than desirable. If you use a DIB to hold the screen image, device-dependent information is removed from the bitmap. This simplifies the process of displaying the image on devices with different display capabilities. For example, capturing a screen from a 24-bit display adapter and printing it on a 1-bit (monochrome) printer can produce exceptional results if DIBs are used. Additionally, many printer drivers implement gray-scale dithering; the output on these printers is also excellent when DIBs are used. NOTE: Because bitmaps are device-dependent, you should avoid the BitBlt function when printing bitmaps. The type of bitmaps that the BitBlt function requires are normally in the format of the display driver rather than the printer driver. Depending on the drivers involved, the results of using BitBlt to print a bitmap can vary from extremely poor output quality to no output at all. Although all printer drivers are able to BitBlt a monochrome bitmap to the printer, this technique generally produces poor results because the printer cannot apply gray-scaling to the image. This technique of using a DIB to convert a bitmap between display devices with different capabilities can also be used to convert bitmaps while preserving the original color information (for example, loading a 256-color bitmap from a .BMP file and printing it to a 3-color printer or displaying it on a 24-bit display). The file DIBAPI.TXT contains more information on function parameters and usage. A Windows Help file for the DIB APIs is also included. Download WINCAP.EXE, a self-extracting file, from the Microsoft Software Library (MSL) on the following services:
|
Additional reference words: 3.00 printscreen 3.10 softlib WINCAP.EXE
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |