Search code examples
c#themescompatibility

Is there a way to set the compatibility mode in Win7 programmatically in C#


I am working on a program. In testing it on Win7(32-bit, don't know if it will be the same in 64-bit) I found a problem.

Now my problem is that some of the functionality does not work(like the right click doesn't show options or the program takes long to react). If however I set up a the compatibility mode it works fine. I mainly see this problem in Microstation, but it does appear in other places as well.

My question is as follows, is there a way to set these settings(like the check boxes) programmatically from C# ?

This might be necessary in cases where we do not do the installation of the program, to insure that it works on every pc it is installed on. Let us assume that during the installation the program has admin rights. (would it be needed to do this??)

this has nothing to do with Internet Explorer. i wanted to add a picture, but i dont have enough rep yet


Solution

  • There is no way to change this while the application is running, you have two choices to handle this issue:

    • Modify the installer to create shortcuts that have the compatibility mode flag set to whatever you need
    • You can manually manipulate the registry to force an executable to use compatibility mode, your application will require admin rights todo so + will need to restart afterwards
      Here it's explained how todo it manually, you simply have to do it programatically:
      http://kb.winzip.com/kb/entry/139/

    In general I discourage you from doing either, fix your bugs instead.