Return-value of the selected Windows-scalefactor ?

Return-value of the selected Windows-scalefactor ?

Postby ukoenig » Tue Jan 26, 2021 9: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 )

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
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

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

Postby Antonio Linares » Tue Jan 26, 2021 9:51 am

Dear Uwe,

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

This seems to be what you are looking for:
Code: Select all  Expand view
#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
Antonio Linares
Site Admin
 
Posts: 42082
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

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

Postby ukoenig » Tue Jan 26, 2021 10:47 am

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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 94 guests