13.07.2015 Views

REFERENCE GUIDE

REFERENCE GUIDE

REFERENCE GUIDE

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Saving a devicecontextDeleting a devicecontextCompatibledevice contextsOccasionally, it is necessary to save a device context so that theoriginal attributes will be available at a later time. For example, aWindows application may need to save its original clippingregion so that it can restore the client area's original state after aseries of alterations occur. The SaveDC and RestoreDC functionsmake this possible.The DeleteDC function deletes a device context and ensures thatshared resources are not removed until the last context is deleted.The device driver is a shared resource.The CreateCompatibleDC function causes Windows to treat aportion of memory as a virtual device. This means that Windowsprepares a device context that has the same attributes as thedevice for which it was created, but the device context has noconnected output device. To use the compatible device context,the application creates a compatible bitmap and selects it into thedevice context. Any output it sends to the device is drawn in theselected bitmap. Since the device context is compatible with someactual device, the context of the bitmap can be copied directly tothe actual device, or vice versa. This also means that theapplication can send output to memory (prior to sending it to thedevice). Note that the CreateCompatibleDC function works onlyfor devices that have BitBlt capabilities.Informationcontexts The CreatelC function creates an information context for a device.An information context is a device context with limitedcapabilities; it cannot be used to write to the device. Anapplication uses an information context to gather informationabout the selected device. Information contexts are useful in largeapplications that require memory conservation.By using an information context and the GetDeviceCaps function,you can obtain the following device information:90Software development kit

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!