Microsoft Windows CE 3.0  

Obtaining a Memory and Printer Device Context

This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

You can create a memory device context for a device by calling the CreateCompatibleDCfunction and supplying a handle to the device context. Memory device contexts are also called compatible device contexts because they are created to be compatible with a particular device. Windows CE creates a temporary 1 x 1 pixel monochrome bitmap and selects it into the device context after calling CreateCompatibleDC. Before you can draw with this device context, you must call the SelectObjectfunction to select a bitmap with the appropriate width, height, and color depth into the device context. Once the new bitmap is selected into the memory device context, you can use the device context to store images. For more information about image storage, see "Creating Bitmaps" later in this chapter.

You obtain a handle to a printer device context by calling the CreateDCfunction. Call the DeleteDCfunction to delete the printer device context when finished printing.

Note   You must delete, rather than release, a printer or memory device context; the ReleaseDCfunction fails if you try to use it to release a printer or memory device context.

 Last updated on Tuesday, May 18, 2004

© 2004 Microsoft Corporation. All rights reserved.