I have an app that requires a compatibility settings under Windows 7. In the registry, the setting is saved under HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers as "C:\PortableApps\MyApp\App\MyApp.exe=REG_SZ:DISABLETHEMES". The problem is that the app path is part of the registry key name, and I can't find a way to set that and clean it up in Launcher.ini.
I've tried:
[RegistryValueWrite]
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\%PAL:AppDir%=REG_SZ:DISABLETHEMES
and that just creates a registry key named '%PAL:AppDir%'. If I use
[RegistryKeys]
MyApp_HKCU=HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
then that replaces all of the keys under Layers when MyApp starts. If I use
[RegistryKeys]
MyApp_HKCU=HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\%PAL:AppDir%
then that loads the key from the file, but doesn't clean up --- and RegistryCleanupForce does not remove the key with %PAL:AppDir% in the name.
What am I missing?
I searched around a bit, and most of what I found said you need to use the Application Compatibility Toolkit, to make a "Custom Application Compatibility Database", install that to the computer in question, then whenever you run the program on that computer it'll use those Compatibility Settings; however this sounds to me like it's basically the same thing as setting the Compatibility Settings in the Properties Window, and it certainly doesn't sound very Portable, so I kept searching. Eventually I found some references to the
__COMPAT_LAYER
Environment Variable, and after some (limited) testing, I think it should work for you.From reading your post it looks like you just want to disable Visual Themes, the following is an example [Environment] section to add to the launcher.ini file:
Note: For anyone who wants to use this method of enabling Compatibility Mode in a non-PortableApps situation, the following is an example of what can be used in the Command Prompt (or in a Batch File):
Let us know whether or not this works for you.
~3D1T0R
Hi 3D1T0R,
I had ended up using a batch file and the REG commands to add and remove the registry keys, and then using FileWrite to modify/update the name of the registry key in the batch file. Setting the variable in the [Environment] section as you indicated works great, and is simpler, so I'm going to switch to that.
Thanks for the help!
Glad I could be of assistance.
~3D1T0R