Recent

Author Topic: [SOLVED] Windows: how to query the real DPI-setting of the monitor?  (Read 2663 times)

Hartmut

  • Hero Member
  • *****
  • Posts: 891
Re: [SOLVED] Windows: how to query the real DPI-setting of the monitor?
« Reply #30 on: October 21, 2024, 11:09:54 am »
Thanks rvk for this new informations and the link.



You can find it in regedit at:

HKCU/Control Panel/DesktopWindowMetrics

Thanks jcmontherock too. Meanwhile I checked this on my sisters Win10 laptop (which has an increased Font size):
Registry-Key "HKCU/Control Panel/Desktop/WindowMetrics" has value AppliedDPI=120.
On my Win10 computer (which has a normal Font size) value AppliedDPI=96.
So the registry is an alternative to query this setting: 120/96 = 125%

LV

  • Full Member
  • ***
  • Posts: 195
Re: [SOLVED] Windows: how to query the real DPI-setting of the monitor?
« Reply #31 on: October 21, 2024, 11:18:39 am »
Important: the code to detect the 120 dpi must run in a program with setting Project Options / Application / "Use LCL scaling (Hi-DPI)" and "DPI awareness" both = off.
Please, See the attached project and screenshots.

Updated: I have a monitor with a resolution of 2560 x 1440
« Last Edit: October 21, 2024, 11:34:51 am by LV »

PascalDragon

  • Hero Member
  • *****
  • Posts: 5811
  • Compiler Developer
Re: [SOLVED] Windows: how to query the real DPI-setting of the monitor?
« Reply #32 on: October 22, 2024, 09:52:55 pm »
Thanks PascalDragon for that info. Until now I use Unit 'system' for these 3 functions. Is Unit DynLibs anyhow better than Unit 'system' for this?

The LoadLibrary, FreeLibrary and GetProcAddress declarations are provided by the System-unit (at least in current versions), however depending on the platform the implementation is provided by the DynLibs unit, because e.g. on Linux this requires linking against the C-library and by default FPC's RTL avoids that. If you include the DynLibs unit then you'll simply make sure that your program is more cross platform compatible.

 

TinyPortal © 2005-2018