Retrieving the Capabilities of a Printer

Not every output device supports the entire set of Win32 graphics functions. For example, because of hardware limitations, most vector plotters do not support bit-block transfers. An application can determine whether a device supports a particular Win32 graphics function by calling the GetDeviceCaps function, specifying the appropriate index, and examining the return value.

The following example shows how an application tests a printer to determine whether it supports bit-block transfers.

/*

* Examine the raster capabilities of the device

* identified by hdcPrint to verify that it supports

* the BitBlt function.

*/

if ((GetDeviceCaps(hdcPrint, RASTERCAPS)

& RC_BITBLT) == 0) {

DeleteDC(hdcPrint);

break;

}

else

/* Print the bitmap using the printer DC. */