Return-value of the selected Windows-scalefactor ?

Post Reply
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Return-value of the selected Windows-scalefactor ?

Post by ukoenig »

Hello,

it is possible to define a scalefactor inside the windowdesktop defines.
Does a function exists that returns the selected value :?:
Possible values are 100 ( normal ), 125 and 150 %

The problem GETCURSORPOS() works only with selecting 100 % scalefactor
other selections must be adjusted with a defined factor :

local hDeskTop := GETDC(0)
local a := GETCURSORPOS()
// Left Top
local nColor := GETPIXEL( hDeskTop, a[2] * nMonScale, a[1] * nMonScale )

Image

regards
Uwe
Last edited by ukoenig on Tue Jan 26, 2021 10:47 am, edited 3 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Return-value of the selected Windows-scalefactor ?

Post by Antonio Linares »

Dear Uwe,

https://stackoverflow.com/questions/325 ... ws-scaling

This seems to be what you are looking for:

Code: Select all

#include "FiveWin.ch"

#define VERTRES          10
#define DESKTOPVERTRES  117 

function Main()

   local hDC := GetDC( GetDesktopWindow() )
   local nLogicalScreenHeight  := GetDeviceCaps( hDC, VERTRES )
   local nPhysicalScreenHeight := GetDeviceCaps( hDC, DESKTOPVERTRES )
   local nScreenScalingFactor  := nPhysicalScreenHeight / nLogicalScreenHeight
   
   MsgInfo( nScreenScalingFactor ) // 1.00 is 100%, 1.25 is 125%, etc

   ReleaseDC( GetDesktopWindow(), hDC )

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: Return-value of the selected Windows-scalefactor ?

Post by ukoenig »

Dear Antonio,

thank You very much
Your solution works perfect and is tested with the colorpicker :D
the scalefactor is autodetected now

Image

best regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
Post Reply