I needed to override DPI setting value in the windows machine of my Java swing application. For that, I needed to create registry key following path.

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers

In side the Layers key, I created string registry where value is "~DPIUNAWARE". It's worked as expected.

I needed to add the same registry value in to the LOCAL_MACHINE instead of CURRENT_USER. I removed previously created registry under CURRENT_USER and created new registry under

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers

But it's not worked as expected. What could be the issue?

Since my application architecture is 32 bit version, I try to create same registry key under following path also.

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers

It's also not worked. ?

  • Do you have multiple users on this machine? If you only have a single users modifying HKEY_CURRENT_USER should be more than enough. HKEY_LOCAL_MACHINE is only required if the machine has multiple users. if this is for an application you are trying to author, you should modify, HKEY_LOCAL_MACHINE and ``HKEY_CURRENT_USER` depending on the key a reboot will be required to introduce the change. It's not clear the reason you need to modify HKEY_LOCAL_MACHINE though. Please edit your question to make that point clear. – Ramhound Aug 15 '19 at 18:22
  • yes, this application is using more than one users different times in same machine. That is why I just wanted to add this registry in to Local_Machine rather than Current_User – Pubudu Mahesh Meththananda Aug 15 '19 at 18:37

Your Answer

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

Browse other questions tagged or ask your own question.