Page 1 of 1

Return-value of the selected Windows-scalefactor ?

Posted: Tue Jan 26, 2021 9:16 am
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

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

Posted: Tue Jan 26, 2021 9:51 am
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

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

Posted: Tue Jan 26, 2021 10:47 am
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