Partager via


GetDeviceCaps

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

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

    Device can draw chord arcs.

     

    CC_CIRCLES

    Device can draw circles.

     

    CC_ELLIPSES

    Device can draw ellipses.

     

    CC_INTERIORS

    Device can draw interiors.

     

    CC_NONE

    Device does not support curves.

     

    CC_PIE

    Device can draw pie wedges.

     

    CC_ROUNDRECT

    Device can draw rounded rectangles.

     

    CC_STYLED

    Device can draw styled borders.

     

    CC_WIDE

    Device can draw wide borders.

     

    CC_WIDESTYLED

    Device can draw borders that are wide and styled.

    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

    Device can draw interiors.

     

    LC_MARKER

    Device can draw a marker.

     

    LC_NONE

    Device does not support lines.

     

    LC_POLYLINE

    Device can draw a polyline.

     

    LC_POLYMARKER

    Device can draw multiple markers.

     

    LC_STYLED

    Device can draw styled lines.

     

    LC_WIDE

    Device can draw wide lines.

     

    LC_WIDESTYLED

    Device can draw lines that are wide and styled.

    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.

    Windows CE 1.0 and 1.01 do not support this value.

    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.

    Windows CE 1.0 and 1.01 do not support this value.

    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.

    Windows CE 1.0 and 1.01 do not support this value.

    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.

    Windows CE 1.0 and 1.01 do not support this value.

    PLANES

    Number of color planes.

    POLYGONALCAPS

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

     

    PC_INTERIORS

    Device can draw interiors.

     

    PC_NONE

    Device does not support polygons.

     

    PC_POLYGON

    Device can draw alternate-fill polygons.

     

    PC_RECTANGLE

    Device can draw rectangles.

     

    PC_SCANLINE

    Device can draw a single scanline.

     

    PC_STYLED

    Device can draw styled borders.

     

    PC_WIDE

    Device can draw wide borders.

     

    PC_WIDESTYLED

    Device can draw borders that are wide and styled.

     

    PC_WINDPOLYGON

    Device can draw winding-fill polygons.

    RASTERCAPS

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

     

    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 device independent bitmaps.

     

    RC_DIBTODEV

    Unsupported.

     

    RC_GDI20_OUTPUT

    Capable of supporting features of 16-bit Windows 2.0.

     

    RC_PALETTE

    Specifies a palette-based device.

     

    RC_SCALING

    Capable of scaling.

     

    RC_STRETCHBLT

    Unsupported.

     

    RC_STRETCHDIB

    Unsupported.

    SHADEBLENDCAPS

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

     

    SB_CONST_ALPHA

    Handles the SourceConstantAlpha member of the BLENDFUNCTION structure, which is referenced by the blendFunction parameter of the AlphaBlend function.

     

    SB_GRAD_RECT

    Capable of handling GradientFill rectangles.

     

    SB_GRAD_TRI

    Capable of handling GradientFill triangles.

     

    0

    Device does not support any of these capabilities.

     

    SB_PIXEL_ALPHA

    Capable of handling per-pixel alpha in AlphaBlend.

     

    SB_PREMULT_ALPHA

    Capable of handling premultiplied alpha in AlphaBlend.

    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

    Vector plotter

     

    DT_RASDISPLAY

    Raster display

     

    DT_RASPRINTER

    Raster printer

     

    DT_RASCAMERA

    Raster camera

     

    DT_CHARSTREAM

    Character stream

     

    DT_DISPFILE

    Display file

    TEXTCAPS

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

     

    TC_CP_STROKE

    Device is capable of stroke clip precision.

     

    TC_CR_90

    Device is capable of 90-degree character rotation.

     

    TC_CR_ANY

    Device is capable of any character rotation.

     

    TC_EA_DOUBLE

    Device can draw double-weight characters.

     

    TC_IA_ABLE

    Device can italicize.

     

    TC_OP_CHARACTER

    Device is capable of character output precision.

     

    TC_OP_STROKE

    Device is capable of stroke output precision.

     

    TC_RA_ABLE

    Device can draw raster fonts.

     

    TC_RESERVED

    Reserved; must be zero.

     

    TC_SA_CONTIN

    Device uses any multiples for exact character scaling.

     

    TC_SA_DOUBLE

    Device is capable of doubled character for scaling.

     

    TC_SA_INTEGER

    Device uses integer multiples only for character scaling.

     

    TC_SCROLLBLT

    Device cannot scroll using a bit-block transfer.
    This meaning may be the opposite of what you expect.

     

    TC_SF_X_YINDEP

    Device can scale independently in the x- and y-directions.

     

    TC_SO_ABLE

    Device can draw strikeouts.

     

    TC_UA_ABLE

    Device can underline.

     

    TC_VA_ABLE

    Device can draw vector fonts.

    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

Windows CE 1.0 and 1.01 do not support these indexes.

Requirements

Header windows.h
Library coredll.lib
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

GetObjectType
StretchBlt
GDI Functions