Setting windows compatibility mode in VB.NET

Discussion in 'Programmer's Corner' started by cmartinez, Mar 16, 2016.

  1. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,573
    2,537
    I need to set some of my programs written in VB.NET (express, 2012 and 2013) so that they run in win2000 or winXP compatibility mode. The way I do that is by (in the file explorer) right clicking on the compiled executable file, and then setting the appropriate options.

    Question, is there a function, or some sort of windows call, that would allow me to do just that within the code, so that after the program is compiled there would no longer be need to set those options externally?
     
  2. vpoko

    Member

    Jan 5, 2012
    258
    47
    The thing is, compatibility mode isn't a feature of the exe file but is determined by a registry entries with a path to the exe. Your installer will need to write to the registry, specifically HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers

    If you Google that registry key, you should be able to get more info.
     
    cmartinez likes this.
  3. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,573
    2,537
    Thanks for your answer. Is there also an internal workaround for setting the process affinity mode?
     
  4. vpoko

    Member

    Jan 5, 2012
    258
    47
    cmartinez likes this.
  5. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,573
    2,537
    vpoko likes this.
Loading...