Partager via


GetDeviceCaps (Compact 2013)

3/28/2014

This function retrieves information about the capabilities of a specified device.

Syntax

int GetDeviceCaps(
  HDC hdc, 
  int nIndex
);

Parameters

  • hdc
    [in] Handle to the device context.
  • nIndex
    [in] Specifies the item to return.

    This parameter can be one of the following values.

    Value

    Description

    ASPECTX

    Relative width of a device pixel used for line drawing.

    ASPECTXY

    Diagonal width of the device pixel used for line drawing.

    ASPECTY

    Relative height of a device pixel used for line drawing.

    BITSPIXEL

    Number of adjacent color bits for each pixel.

    CLIPCAPS

    Flag that indicates the clipping capabilities of the device.

    If the device can clip to a rectangle, it is 1. Otherwise, it is 0.

    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 is compatible with 16-bit Windows.

    CURVECAPS

    Value that indicates the curve capabilities of the device, as shown in the following list:

     

    CC_CHORD

     

    CC_CIRCLES

     

    CC_ELLIPSES

     

    CC_INTERIORS

     

    CC_NONE

     

    CC_PIE

     

    CC_ROUNDRECT

     

    CC_STYLED

     

    CC_WIDE

     

    CC_WIDESTYLED

    DRIVERVERSION

    The device driver version.

    HORZRES

    Width, in pixels, of the screen.

    HORZSIZE

    Width, in millimeters, of the physical screen.

    LINECAPS

    Value that indicates the line capabilities of the device, as shown in the following list:

     

    LC_INTERIORS

     

    LC_MARKER

     

    LC_NONE

     

    LC_POLYLINE

     

    LC_POLYMARKER

     

    LC_STYLED

     

    LC_WIDE

     

    LC_WIDESTYLED

    LOGPIXELSX

    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.

    LOGPIXELSY

    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.

    NUMBRUSHES

    Number of device-specific brushes.

    NUMCOLORS

    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.

    NUMFONTS

    Number of device-specific fonts.

    NUMPENS

    Number of device-specific pens.

    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 is compatible with 16-bit Windows.

    PDEVICESIZE

    Reserved.

    PHYSICALHEIGHT

    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"x11" paper has a physical height value of 6600 device units.

    The physical page is almost always greater than the printable area of the page, and never smaller.

    PHYSICALOFFSETX

    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"x11" paper, that cannot print on the leftmost 0.25" of paper, has a horizontal physical offset of 150 device units.

    PHYSICALOFFSETY

    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"x11" paper, that cannot print on the topmost 0.5" of paper, has a vertical physical offset of 300 device units.

    PHYSICALWIDTH

    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" paper has a physical width value of 5100 device units.

    The physical page is almost always greater than the printable area of the page, and never smaller.

    PLANES

    Number of color planes.

    POLYGONALCAPS

    Value that indicates the polygon capabilities of the device, as shown in the following list:

     

    PC_INTERIORS

     

    PC_NONE

     

    PC_POLYGON

     

    PC_RECTANGLE

     

    PC_SCANLINE

     

    PC_STYLED

     

    PC_WIDE

     

    PC_WIDESTYLED

     

    PC_WINDPOLYGON

    RASTERCAPS

    Value that indicates the raster capabilities of the device, as shown in the following list:

     

    RC_BANDING

     

    RC_BITBLT

     

    RC_BITMAP64

     

    RC_DI_BITMAP

     

    RC_DIBTODEV

     

    RC_GDI20_OUTPUT

     

    RC_PALETTE

     

    RC_SCALING

     

    RC_STRETCHBLT

     

    RC_STRETCHDIB

    SHADEBLENDCAPS

    Value that indicates the shading and blending capabilities of the device. See Remarks for further comments.

     

    SB_CONST_ALPHA

     

    SB_GRAD_RECT

     

    SB_GRAD_TRI

     

    0

     

    SB_PIXEL_ALPHA

     

    SB_PREMULT_ALPHA

    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 is compatible with 16-bit Windows.

    TECHNOLOGY

    Device technology. It can be any one of the following values.

     

    DT_PLOTTER

     

    DT_RASDISPLAY

     

    DT_RASPRINTER

     

    DT_RASCAMERA

     

    DT_CHARSTREAM

     

    DT_DISPFILE

    TEXTCAPS

    Value that indicates the text capabilities of the device, as shown in the following list:

     

    TC_CP_STROKE

     

    TC_CR_90

     

    TC_CR_ANY

     

    TC_EA_DOUBLE

     

    TC_IA_ABLE

     

    TC_OP_CHARACTER

     

    TC_OP_STROKE

     

    TC_RA_ABLE

     

    TC_RESERVED

     

    TC_SA_CONTIN

     

    TC_SA_DOUBLE

     

    TC_SA_INTEGER

     

    TC_SCROLLBLT

     

    TC_SF_X_YINDEP

     

    TC_SO_ABLE

     

    TC_UA_ABLE

     

    TC_VA_ABLE

    TOUCHCAPS

    Type of touch hardware controller supported by the device.

    TC_NO_TOUCH

    TC_SINGLE_TOUCH

    TC_SYMMETRIC_TOUCH

    TC_MULTI_TOUCH

    VERTRES

    Height, in raster lines, of the screen.

    VERTSIZE

    Height, in millimeters, of the physical screen.

Return Value

Returns the value of the desired item.

Remarks

The following table shows the six indexes that GetDeviceCaps provides in place of printer escapes.

Index

Printer escape replaced

PHYSICALWIDTH

GETPHYSPAGESIZE

PHYSICALHEIGHT

GETPHYSPAGESIZE

PHYSICALOFFSETX

GETPRINTINGOFFSET

PHYSICALOFFSETY

GETPHYSICALOFFSET

Requirements

Header

windows.h

Library

coredll.lib

See Also

Reference

GDI Functions
GetObjectType
StretchBlt