Recent

Author Topic: How I can get screen resolutions?  (Read 16626 times)

lublinkermi

  • New Member
  • *
  • Posts: 46
How I can get screen resolutions?
« on: January 26, 2010, 10:24:19 am »
Hi, I need help to find any procedure to find resolution screen ? I need coordinate X  and Y for creating applications works fine in any resolutions... In PHP is very, very simple... Please help me!

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1891
Re: How I can get screen resolutions?
« Reply #1 on: January 26, 2010, 10:30:15 am »
Screen.Height
Screen.Width
Screen.PixelsPerInch

lublinkermi

  • New Member
  • *
  • Posts: 46
Re: How I can get screen resolutions?
« Reply #2 on: January 27, 2010, 08:37:53 am »
Thank You!

Zaher

  • Hero Member
  • *****
  • Posts: 604
    • parmaja.com
Re: How I can get screen resolutions?
« Reply #3 on: January 27, 2010, 01:15:45 pm »
>In PHP is very, very simple
PHP generate HTML, sp you must say HTML and CSS.
Layouts in HTML and CSS more flexible than GUI app like Delphi and Lazarus.

vonskie

  • Full Member
  • ***
  • Posts: 139
Re: How I can get screen resolutions?
« Reply #4 on: December 05, 2019, 03:39:01 am »
var
  dm: tDEVMODE;
begin

 
  FillChar(dm,SizeOf(dm) ,#0 );
  dm.dmSize := sizeof(dm);
  EnumDisplaySettings(nil, ENUM_CURRENT_SETTINGS, @dm);
  showmessage(inttostr(dm.dmPelsHeight));
  showmessage(inttostr(dm.dmPelsWidth));
  end;     

This is true resolution font scaling will not mess it up

PascalDragon

  • Hero Member
  • *****
  • Posts: 2418
  • Compiler Developer
Re: How I can get screen resolutions?
« Reply #5 on: December 05, 2019, 10:05:44 am »
var
  dm: tDEVMODE;
begin

 
  FillChar(dm,SizeOf(dm) ,#0 );
  dm.dmSize := sizeof(dm);
  EnumDisplaySettings(nil, ENUM_CURRENT_SETTINGS, @dm);
  showmessage(inttostr(dm.dmPelsHeight));
  showmessage(inttostr(dm.dmPelsWidth));
  end;     

This is true resolution font scaling will not mess it up
This will only work on Windows however.

wp

  • Hero Member
  • *****
  • Posts: 7737
Re: How I can get screen resolutions?
« Reply #6 on: December 05, 2019, 10:44:14 am »
Hi, I need help to find any procedure to find resolution screen ? I need coordinate X  and Y for creating applications works fine in any resolutions...
Check the box "Use LCL scaling (High-DPI)" in "Project" > "Project Options". On Windows also select an appropriate "On" setting in the "DPI awareness" combobox. Make sure that "Use manifest resource" is checked. Then your program will be scaled automatically.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

vonskie

  • Full Member
  • ***
  • Posts: 139
Re: How I can get screen resolutions?
« Reply #7 on: December 12, 2019, 03:24:00 am »
I used the below code for a while and ran into problems as sometimes it could not get the resolution

I then changed ENUM_CURRENT_SETTINGS to ENUM_REGISTRY_SETTINGS and it works every time in windows.


var
  dm: tDEVMODE;
begin

 
  FillChar(dm,SizeOf(dm) ,#0 );
  dm.dmSize := sizeof(dm);
  EnumDisplaySettings(nil, ENUM_CURRENT_SETTINGS, @dm);
  showmessage(inttostr(dm.dmPelsHeight));
  showmessage(inttostr(dm.dmPelsWidth));
  end;     

This is true resolution font scaling will not mess it up

 

TinyPortal © 2005-2018