You can create a memory device context for a device by calling the CreateCompatibleDC function 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 SelectObject function 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 CreateDC function. Call the DeleteDC function to delete the printer device context when finished printing.
Note You must delete, rather than release, a printer or memory device context; the ReleaseDC function fails if you try to use it to release a printer or memory device context.