Jump to content
Hans♫

Delphi 10.3 | Windows: IFMXScreenService.GetScreenScale broken?

Recommended Posts

I use ScreenService.GetScreenScale to get the Screen scaling. It was partly broken in 10.2.3, but in 10.3 it seems to be completely broken. 

In 10.3: No matter what scaling is set in Windows: 150%, 175% or 200%, the return value of ScreenService.GetScreenScale is 1.0. 

In 10.2.3 it did return the value 1.5 with 150% scaling, but with 175% and 200% scaling it also returned 1.5

I post it here before I post it as a bug in QP, in case I missed something...?

 

This is the function where I use it (and yes it does actually call GetScreenScale):

function tScreenScale.GetScreenScale: Single;
var ScreenService: IFMXScreenService;
begin
  Result := 1;
  if TPlatformServices.Current.SupportsPlatformService (IFMXScreenService, IInterface(ScreenService)) then
    Result := ScreenService.GetScreenScale;
end;

 

Share this post


Link to post

This is just an idea, maybe it matters whether the executable is being debugged, started from IDE or started from explorer? Maybe it inherits some settings from its parent process (the IDE).

Share this post


Link to post

I've checked this function in 10.2.3 and 10.3, and it works identically in both cases. When I set a text size = 125%, the app shows 1.25.

Windows 7 64 bit. Demo app is attached.

TestGetScreenScale.zip

Share this post


Link to post

Thanks for the demo app. Compiled with 10.3 it gave the same result as previously - until I logged out of Windows and in again, then it worked.

Apparently in Windows 10 GetScreenScale returns only the value present at login time, that's why my first experiments did not work.

Later I turned on the "Fix blurred apps" setting in Windows 10 and then it returns the correct value immediately even without logging in again.

 

That's great, so Rio 10.3 works!

However, when compiled with 10.2.3 it now always returns 1.0, even if I reboot after having changed the scaling in Windows. I am going to figure out why that happens...

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×