Page 1 of 1

[device dots per inch] for monitor

PostPosted: June 2nd, 2006, 6:32 am
by N.Y.P.D.
Ladis and Genttlemen, how to get [device dots per inch] for device, which is called monitor. (I am stupid, I need example).

PostPosted: June 2nd, 2006, 1:36 pm
by Kambiz
The following function returns horizontal and vertical DPI of the screen as a point.

Code: Select all
function GetScreenDPI: TPoint;
var
  DC: HDC;
begin
  DC := GetDC(0);
  try
    Result.X := GetDeviceCaps(DC, LOGPIXELSX);
    Result.Y := GetDeviceCaps(DC, LOGPIXELSY);
  finally
    ReleaseDC(0, DC);
  end;
end;


By the way, needing an example has nothing to do with stupidity. All of us get things better when there is an example. ;)