GetDeviceCaps function (wingdi.h)
The GetDeviceCaps function retrieves device-specific information for the specified device.
Syntax
int GetDeviceCaps(
[in] HDC hdc,
[in] int index
);
Parameters
[in] hdc
A handle to the DC.
[in] index
The item to be returned. This parameter can be one of the following values.
Index | Meaning | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
The device driver version. | ||||||||||||||||||||||||||||||||||
|
Device technology. It can be any one of the following values.
If the hdc parameter is a handle to the DC of an enhanced metafile, the device technology is that of the referenced device as specified to the CreateEnhMetaFile function. To determine whether it is an enhanced metafile DC, use the GetObjectType function. |
||||||||||||||||||||||||||||||||||
|
Width, in millimeters, of the physical screen. | ||||||||||||||||||||||||||||||||||
|
Height, in millimeters, of the physical screen. | ||||||||||||||||||||||||||||||||||
|
Width, in pixels, of the screen; or for printers, the width, in pixels, of the printable area of the page. | ||||||||||||||||||||||||||||||||||
|
Height, in raster lines, of the screen; or for printers, the height, in pixels, of the printable area of the page. | ||||||||||||||||||||||||||||||||||
|
Number of pixels per logical inch along the screen width. In a system with multiple display monitors, this value is the same for all monitors. | ||||||||||||||||||||||||||||||||||
|
Number of pixels per logical inch along the screen height. In a system with multiple display monitors, this value is the same for all monitors. | ||||||||||||||||||||||||||||||||||
|
Number of adjacent color bits for each pixel. | ||||||||||||||||||||||||||||||||||
|
Number of color planes. | ||||||||||||||||||||||||||||||||||
|
Number of device-specific brushes. | ||||||||||||||||||||||||||||||||||
|
Number of device-specific pens. | ||||||||||||||||||||||||||||||||||
|
Number of device-specific fonts. | ||||||||||||||||||||||||||||||||||
|
Number of entries in the device's color table, if the device has a color depth of no more than 8 bits per pixel. For devices with greater color depths, -1 is returned. | ||||||||||||||||||||||||||||||||||
|
Relative width of a device pixel used for line drawing. | ||||||||||||||||||||||||||||||||||
|
Relative height of a device pixel used for line drawing. | ||||||||||||||||||||||||||||||||||
|
Diagonal width of the device pixel used for line drawing. | ||||||||||||||||||||||||||||||||||
|
Reserved. | ||||||||||||||||||||||||||||||||||
|
Flag that indicates the clipping capabilities of the device. If the device can clip to a rectangle, it is 1. Otherwise, it is 0. | ||||||||||||||||||||||||||||||||||
|
Number of entries in the system palette. This index is valid only if the device driver sets the RC_PALETTE bit in the RASTERCAPS index and is available only if the driver is compatible with 16-bit Windows. | ||||||||||||||||||||||||||||||||||
|
Number of reserved entries in the system palette. This index is valid only if the device driver sets the RC_PALETTE bit in the RASTERCAPS index and is available only if the driver is compatible with 16-bit Windows. | ||||||||||||||||||||||||||||||||||
|
Actual color resolution of the device, in bits per pixel. This index is valid only if the device driver sets the RC_PALETTE bit in the RASTERCAPS index and is available only if the driver is compatible with 16-bit Windows. | ||||||||||||||||||||||||||||||||||
|
For printing devices: the width of the physical page, in device units. For example, a printer set to print at 600 dpi on 8.5-x11-inch paper has a physical width value of 5100 device units. Note that the physical page is almost always greater than the printable area of the page, and never smaller. | ||||||||||||||||||||||||||||||||||
|
For printing devices: the height of the physical page, in device units. For example, a printer set to print at 600 dpi on 8.5-by-11-inch paper has a physical height value of 6600 device units. Note that the physical page is almost always greater than the printable area of the page, and never smaller. | ||||||||||||||||||||||||||||||||||
|
For printing devices: the distance from the left edge of the physical page to the left edge of the printable area, in device units. For example, a printer set to print at 600 dpi on 8.5-by-11-inch paper, that cannot print on the leftmost 0.25-inch of paper, has a horizontal physical offset of 150 device units. | ||||||||||||||||||||||||||||||||||
|
For printing devices: the distance from the top edge of the physical page to the top edge of the printable area, in device units. For example, a printer set to print at 600 dpi on 8.5-by-11-inch paper, that cannot print on the topmost 0.5-inch of paper, has a vertical physical offset of 300 device units. | ||||||||||||||||||||||||||||||||||
|
For display devices: the current vertical refresh rate of the device, in cycles per second (Hz).
A vertical refresh rate value of 0 or 1 represents the display hardware's default refresh rate. This default rate is typically set by switches on a display card or computer motherboard, or by a configuration program that does not use display functions such as ChangeDisplaySettings. |
||||||||||||||||||||||||||||||||||
|
Scaling factor for the x-axis of the printer. | ||||||||||||||||||||||||||||||||||
|
Scaling factor for the y-axis of the printer. | ||||||||||||||||||||||||||||||||||
|
Preferred horizontal drawing alignment, expressed as a multiple of pixels. For best drawing performance, windows should be horizontally aligned to a multiple of this value. A value of zero indicates that the device is accelerated, and any alignment may be used. | ||||||||||||||||||||||||||||||||||
|
Value that indicates the shading and blending capabilities of the device. See Remarks for further comments.
|
||||||||||||||||||||||||||||||||||
|
Value that indicates the raster capabilities of the device, as shown in the following table.
|
||||||||||||||||||||||||||||||||||
|
Value that indicates the curve capabilities of the device, as shown in the following table.
|
||||||||||||||||||||||||||||||||||
|
Value that indicates the line capabilities of the device, as shown in the following table:
|
||||||||||||||||||||||||||||||||||
|
Value that indicates the polygon capabilities of the device, as shown in the following table.
|
||||||||||||||||||||||||||||||||||
|
Value that indicates the text capabilities of the device, as shown in the following table.
|
||||||||||||||||||||||||||||||||||
|
Value that indicates the color management capabilities of the device.
|
Return value
The return value specifies the value of the desired item.
When nIndex is BITSPIXEL and the device has 15bpp or 16bpp, the return value is 16.
Remarks
When nIndex is SHADEBLENDCAPS:
- For a printer, GetDeviceCaps returns whatever the printer reports.
- For a display device, all blending operations are available; besides SB_NONE, the only return values are SB_CONST_ALPHA and SB_PIXEL_ALPHA, which indicate whether these operations are accelerated.
Index | Printer escape replaced |
---|---|
PHYSICALWIDTH | GETPHYSPAGESIZE |
PHYSICALHEIGHT | GETPHYSPAGESIZE |
PHYSICALOFFSETX | GETPRINTINGOFFSET |
PHYSICALOFFSETY | GETPHYSICALOFFSET |
SCALINGFACTORX | GETSCALINGFACTOR |
SCALINGFACTORY | GETSCALINGFACTOR |
Examples
For an example, see Preparing to Print.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | wingdi.h (include Windows.h) |
Library | Gdi32.lib |
DLL | Gdi32.dll |