Saving and Restoring Device Contexts

Use the GetDeviceCaps function to retrieve device data using a device context for any of the following types of devices:

GetDeviceCaps can provide information about a device's color format and raster capabilities, as well as its shape, text, and line drawing capibilites. You supply GetDeviceCaps with a handle to a device context and an index specifying the type of data to be retrieved.

The SaveDC function records the condition of your device context's graphic objects and graphic modes on a special GDI stack. You can call this function to save your application's original state, providing you with a "clean slate" for later drawing. Call RestoreDC to return the DC to this original state.