检索打印机的功能
并非每个输出设备都支持整个图形函数集。 例如,由于硬件限制,大多数矢量绘图器不支持位块传输。 应用程序可以通过调用 GetDeviceCaps 函数、指定适当的索引并检查返回值来确定设备是否支持特定的图形函数。
以下示例演示应用程序如何测试打印机以确定它是否支持位块传输。
// 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.
}