11

I am compiling and building an OpenCV app on Windows 10, which shows some images.
I want to overrride the high DPI scaling behavior and set it to "Application".

I can do this fine on the .exe file by: Right-Click->Properties->Compatibility Tab and checking the checkbox.:

enter image description here

Is there a command line tool I can use to do that as part of a script?

11

You make a bat file script.

Things to change in commands

Make sure where the application is Placed

If the application is 64 bit "%programfiles%\<appfoldername>\<app>.exe"

If the application is 32 bit "%programfiles(x86)\<appfoldername>\<app>.exe"

~HIGHDPIAWARE Indicates value of Override high DPI scaling behavior (Application)

~DPIUNAWARE Indicates value of Override high DPI scaling behavior (System)

"~GDIDPISCALING DPIUNAWARE" Indicates value of Override high DPI scaling behavior (System Enhanced) add double quote also

I am doing this for Itunes (64 bit).

Particular User

REG ADD "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /V "%programfiles%\iTunes\iTunes.exe" /T REG_SZ /D ~HIGHDPIAWARE /F

All User

REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /V "%programfiles%\iTunes\iTunes.exe" /T REG_SZ /D ~HIGHDPIAWARE /F
| improve this answer | |
  • So the Win10 prop-dlg actually generates a registry entry too? – Adi Shavit Jul 16 '17 at 13:08
  • yes. i have tested in windows 10 it worked. its registry to be changed – Techie Gossip Jul 16 '17 at 13:10
  • 1
    Thanks! Will check. Based on your answer I found this from MS which essentially says the same thing :-). – Adi Shavit Jul 16 '17 at 13:16
  • 1
    On Windows 10, I needed a space between the tilde and the dpi scaling value -- "~ DPIUNAWARE" – Brendan Abel Jun 28 '19 at 16:27
  • From @AdiShavit MS link and my own experimentation, "Note that there is a space between the tilde and the HIGHDPIAWARE." – rjt Jul 4 '19 at 21:57
0

Following the previous advice I added the reg value HKLM\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers with a value of ~ DPIUNAWARE including the space after the tilde.

However, it turned out that this DOES NOT work, UNLESS I set and remove the corresponding setting for the current user in HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers.

So my solution follows those above but requires the HKCU key to be set and reset in advance.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.