FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Return-value of the selected Windows-scalefactor ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Return-value of the selected Windows-scalefactor ?
Posted: Tue Jan 26, 2021 09:16 AM
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 )



regards
Uwe
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.
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Return-value of the selected Windows-scalefactor ?
Posted: Tue Jan 26, 2021 09:51 AM
Dear Uwe,

https://stackoverflow.com/questions/32586883/windows-scaling

This seems to be what you are looking for:
Code (fw): Select all Collapse
#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
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Return-value of the selected Windows-scalefactor ?
Posted: Tue Jan 26, 2021 10:47 AM
Dear Antonio,

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



best regards
Uwe :-)
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.

Continue the discussion