Registry method for setting compatibility mode on an exe?

Hi Windows gurus -

I’ve got a project that needs to include a helper binary that - while it runs properly on all versions of Windows - requires that compatibility mode for Vista SP 3 be set. The code that creates this exe will not compile with newer versions of CL/Link (VS2003 is the newest) and I don’t have the “permission” of the author to modify that.

What I’m looking for is the magic registry key to create that will set the compatibility flag for the helper so that the support team aren’t always explaining to new users how to set that mode. I’d then set that key as part of the parent app’s startup using Xojo Registry methods.

Given a tool named “keygen-4k.exe” in a “Tools” folder within the app’s folder, what would the magic key and entry point be?

It looks like the Registry key you want to modify is (per-user) HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers or (all users, need admin rights to edit) HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers

i.e. Something like this sets Vista SP2 mode (there is no SP3):

Dim reg As New RegistryItem("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers", False) reg.Value("C:\\Path\\To\\My\\App.exe") = "VISTASP2"

See the tables here for a list of compatibility mode strings. Multiple modes can be listed with a space between them.

Thanks, @Andrew Lambert - now that I see what to look for, a quick search on MSDN provided more info as well.

Amazing how you can find stuff when yo know WHAT you’re searching for :S