GetDeviceCaps function
Returns various device specific information.
Declaration
function GetDeviceCaps(DC: HDC; Index: Integer): IntegerDescription
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
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
