Get Monitor Scale Factor

In my application I’d like to find what scaling factor each monitor is set to.

I’ve tried GetScaleFactorForMonitor (from SHCORE.DLL) but it returns 140 for my 4K monitor when Windows shows it as 150%. The other monitors that are set to 100% all return 100.

Am I misunderstanding something or is there a better way to get this info?

Use the Screen variable; the Monitors items have the PixelsPerInch property, compare to 96

Scaling for HiDPI - how to make your apps work properly at any screen resolution with Ian Barker

Malcolm Cheyne
Townsville

1 Like

Screen.PixelsPerInch says 96 so not sure how that helps. This is with Delphi XE so that’s possibly the issue?

Yes, that’s a problem. Most of the changes for HiDPI support came with the version 12 releases although from XE5 onwards things improved too.

I do have Delphi 12 so any changes will have to wait until I can migrate my project to it.