Memory Device Contexts

You use a memory device context to store bit images images in memory rather than sending it to an output device. A memory DC allows Windows CE to treat a portion of memory as a virtual device. You can create a memory device context for a particular device by calling the CreateCompatibleDC function and supplying a handle to the device's DC. Memory DCs are also called compatible DCs because they are created to be compatible with a particular device. Windows CE will create a temporary 1 pixel by 1 pixel, monochrome bitmap and select it into the DC after calling CreateCompatibleDC. Before you can begin drawing with this DC, you must use the SelectObject function to select a bitmap with the appropriate width and height into the DC. Once the new bitmap is selected into the memory device context, you can use the DC to store images. For more information on image storage, see the "Bitmaps" section later in this chapter.