You are here

How to handle %PAL:AppDir% in registry key name?

4 posts / 0 new
Last post
chaz
Offline
Last seen: 10 years 11 months ago
Joined: 2011-08-30 11:02
How to handle %PAL:AppDir% in registry key name?

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?

3D1T0R
3D1T0R's picture
Offline
Last seen: 2 years 8 months ago
Developer
Joined: 2006-12-29 23:48
Environment Variable: __COMPAT_LAYER

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:

[Environment]
__COMPAT_LAYER=DISABLETHEMES

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):

:: Set the "Disable Visual Themes" Compatibility Mode
SET __COMPAT_LAYER=DISABLETHEMES
:: Run the program that requires this
start "X:\Path\To\Application.exe"
:: Disable Compatibility Mode (by removing the Environment Variable)
SET __COMPAT_LAYER=

Let us know whether or not this works for you.

~3D1T0R

chaz
Offline
Last seen: 10 years 11 months ago
Joined: 2011-08-30 11:02
That worked!

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!

3D1T0R
3D1T0R's picture
Offline
Last seen: 2 years 8 months ago
Developer
Joined: 2006-12-29 23:48
No Problem:

Glad I could be of assistance.

~3D1T0R

Log in or register to post comments