[Overview][Types][Procedures and functions][Variables][Index] | Reference for unit 'LCLIntf' (#lcl)

# GetDeviceCaps

Returns various device specific information.

## Declaration

Source position: winapih.inc line 124

`function GetDeviceCaps(`
`DC: HDC;`
`Index: Integer`
`):Integer;`

## Description

Returns information about any DC (Device Context), which might be the screen DC representing the monitor, a control canvas or a off-screen bitmap canvas. The following constants can be utilized in the index argument:

- HORZSIZE
- VERTSIZE
- HORZRES
- BITSPIXEL
- PLANES
- SIZEPALETTE
- LOGPIXELSX - the DPI in the X axis
- LOGPIXELSY - the DPI in the Y axis
- VERTRES
- NUMRESERVED

An example showing how to obtain the screen DPI for the X axis using GetDeviceCaps, which is the method utilized by TScreen.PixelsPerInch:

    var
      DC: HDC;
    begin
      DC := GetDC(0);
      FDPI := GetDeviceCaps(DC,LOGPIXELSX); // DPI in pixels per inch
      ReleaseDC(0, DC);
    end;

## See also

TScreen.PixelsPerInch |  | The number of screen pixels per virtual inch (DPI) for the screen.
HORZSIZE |  | Horizontal size in millimeters.
VERTSIZE |  | Vertical size in millimeters.
HORZRES |  | Horizontal width in pixels for a device context.
BITSPIXEL |  | Number of bits per pixel.
PLANES |  | Number of color planes.
SIZEPALETTE |  | Number of entries in the color palette.
LOGPIXELSX |  | The number of pixels per logical inch, in X (horizontal) direction.
LOGPIXELSY |  | The number of pixels per logical inch, in Y (vertical) direction.
VERTRES |  | Vertical height in pixels for a device context.
NUMRESERVED |  | Number of reserved entries in the color palette.