Getting Display Scale

Started by JTaylor, March 07, 2025, 02:08:00 PM

Previous topic - Next topic

JTaylor

Started a new thread as the other was getting cluttered.

I have cracked the code.

http://www.jtdata.com/anonymous/wbOmnibus.zip

Look at snScreenScale() in the Help.



For this to work you must set a value in the following Registry Key.  Obviously this could be easily done in any script with the Registry Functions.


      Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers[APP_FILEPATH]


      You must set it to "~ HIGHDPIAWARE"


      Example of registry screen when properly set.  The following will allow any WBT file to return correct scaling, assuming it is run by winbatch_if.exe:

         C:\Program Files (x86)\WinBatch\System\winbatch_if.exe           REG_SZ          ~ HIGHDPIAWARE



         The following will allow the specified compiled app to return correct scaling:

         D:\Extenders\OmniDLG\dlg_demo\List_View_Events.exe             REG_SZ          ~ HIGHDPIAWARE


Jim

td

WinBatch exe's are already set to be highdpiaware internally. They are not, however, set to per-monitor awareness, which is Kirby's issue. Per-monitor DPI awareness was not supported until the later versions of Windows 10, which presents compatibility issues.

It is not as simple as changing a setting. It can also require significant recoding.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

JTaylor

All I have said is that if one sets that registry entry, my Extender will return the proper scaling for the monitor that is active from which the script is called.  If you pass the right parameter it will return all the displays and their scaling. It does on my machines anyway.  I will have to wait and see if anyone tries it to find out if they disagree.   I assume you haven't tried it?

Could be version issues I suppose.  I only have the one.

Jim

JTaylor

Just to clarify, the C++ code that I previously posted is not what I used to make this work and simply changing the Registry Entry and using the DLL call that was previously posted will not work.  I was not lying though. Adding the registry entry with the most recent version of the Extender works for me.  I have no reason to believe it won't work for others as well.  As you noted, perhaps the Windows version will come into play and it would be great if others will test and we can find what does and doesn't work.  I tried to fire up some of my old machines but they, apparently, have sat too long.

Jim

JTaylor

No one?  :-(

Thought there was interest in a solution to this issue???   Oh well, hopefully someone will give it a go sometime and report back.

Jim