int GetDeviceCaps(hDC,nIndex)
This function retrieves device-specific information about a given display device. The
nIndex parameter specifies the type of information desired.
Parameter | Type/Description |
hDC | HDC Identifies the device context. | |
nIndex | int Specifies the item to return. It can be any one of the values given in Table R.9, “GDI Information Indexes.” |
The return value specifies the value of the desired item.
Table R.9 lists the values for the nIndex parameter:
Table R.9 GDI Information Indexes
Index | Meaning |
DRIVERVERSION | Version number; for example, 0x100 for 1.0. | ||
TECHNOLOGY | Device technology. It can be any one of the following values: | ||
Value | Meaning | ||
DT_PLOTTER | Vector plotter | ||
DT_RASDISPLAY | Raster display | ||
DT_RASPRINTER | Raster printer | ||
DT_RASCAMERA | Raster camera | ||
DT_CHARSTREAM | Character stream | ||
DT_METAFILE | Metafile | ||
DT_DISPFILE | Display file | ||
HORZSIZE | Width of the physical display (in millimeters). | ||
VERTSIZE | Height of the physical display (in millimeters). | ||
HORZRES | Width of the display (in pixels). | ||
VERTRES | Height of the display (in raster lines). | ||
LOGPIXELSX | Number of pixels per logical inch along the display width. | ||
LOGPIXELSY | Number of pixels per logical inch along the display height. | ||
BITSPIXEL | Number of adjacent color bits for each pixel. | ||
PLANES | Number of color planes. | ||
NUMBRUSHES | Number of device-specific brushes. | ||
NUMPENS | Number of device-specific pens. | ||
NUMFONTS | Number of device-specific fonts. | ||
NUMCOLORS | Number of entries in the device's color table. | ||
ASPECTX | Relative width of a device pixel as used for line drawing. | ||
ASPECTY | Relative height of a device pixel as used for line drawing. | ||
ASPECTXY | Diagonal width of the device pixel as used for line drawing. | ||
PDEVICESIZE | Size of the PDEVICE internal data structure. | ||
CLIPCAPS | Flag that indicates the clipping capabilities of the device. It is 1 if the device can clip to a rectangle, 0 if it cannot. | ||
SIZEPALETTE | 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 version is 3.0 or higher. |
Table R.9 GDI Information Indexes (continued)
Index | Meaning |
NUMRESERVED | 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 version is 3.0 or higher. | ||
COLORRES | 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 version is 3.0 or higher. | ||
RASTERCAPS | Value that indicates the raster capabilities of the device, as shown in the following list: | ||
Capability | Meaning | ||
RC_BANDING | Requires banding support. | ||
RC_BITBLT | Capable of transferring bitmaps. | ||
RC_BITMAP64 | Capable of supporting bitmaps larger than 64K. | ||
RC_DI_BITMAP | Capable of supporting SetDIBits and GetDIBits. | ||
RC_DIBTODEV | Capable of supporting the SetDIBitsToDevice function. | ||
RC_FLOODFILL | Capable of performing flood fills. | ||
RC_GDI20_OUTPUT | Capable of supporting Windows version 2.0 features. | ||
RC_PALETTE | Palette-based device. | ||
RC_SCALING | Capable of scaling. | ||
RC_STRETCHBLT | Capable of performing the StretchBlt function. | ||
RC_STRETCHDIB | Capable of performing the StretchDIBits function. | ||
CURVECAPS | A bitmask that indicates the curve capabilities of the device. The bits have the following meanings: | ||
Bit | Meaning | ||
0 | Device can do circles. | ||
1 | Device can do pie wedges. | ||
2 | Device can do chord arcs. | ||
3 | Device can do ellipses. | ||
4 | Device can do wide borders. | ||
5 | Device can do styled borders. | ||
6 | Device can do borders that are wide and styled. | ||
7 | Device can do interiors. | ||
The high byte is 0. | |||
LINECAPS | A bitmask that indicates the line capabilities of the device. The bits have the following meanings: | ||
Bit | Meaning | ||
0 | Reserved. | ||
1 | Device can do polyline. | ||
2 | Reserved. | ||
3 | Reserved. | ||
4 | Device can do wide lines. | ||
5 | Device can do styled lines. | ||
6 | Device can do lines that are wide and styled. | ||
7 | Device can do interiors. | ||
The high byte is 0. | |||
POLYGONALCAPS | A bitmask that indicates the polygonal capabilities of the device. The bits have the following meanings: | ||
Bit | Meaning | ||
0 | Device can do alternate fill polygon. | ||
1 | Device can do rectangle. | ||
2 | Device can do winding number fill polygon. | ||
3 | Device can do scanline. | ||
4 | Device can do wide borders. | ||
5 | Device can do styled borders. | ||
6 | Device can do borders that are wide and styled. | ||
7 | Device can do interiors. | ||
The high byte is 0. | |||
TEXTCAPS | A bitmask that indicates the text capabilities of the device. The bits have the following meanings: | ||
Bit | Meaning | ||
0 | Device can do character output precision. | ||
1 | Device can do stroke output precision. | ||
2 | Device can do stroke clip precision. | ||
3 | Device can do 90-degree character rotation. | ||
4 | Device can do any character rotation. | ||
5 | Device can do scaling independent of X and Y. | ||
6 | Device can do doubled character for scaling. | ||
7 | Device can do integer multiples for scaling. | ||
8 | Device can do any multiples for exact scaling. | ||
9 | Device can do double-weight characters. | ||
10 | Device can do italicizing. | ||
11 | Device can do underlining. | ||
12 | Device can do strikeouts. | ||
13 | Device can do raster fonts. | ||
14 | Device can do vector fonts. | ||
15 | Reserved. Must be returned zero. |
For a list of all the available abilities, see the LOGFONT data structure in Chapter 7, “Data Types and Structures.”