title: App is unable to write to the registry, even though the user has administrative privileges
body: <p>I am using Visual Studio 2010, and I'm writing a program that needs to set (and read) new registry values under <code>HKLM\Software\myapp</code> </p>
  
  <p>The program is .NET 2.0-based and as for now it runs on Windows 7 64-bit. Here is my ocde:</p>
  
  <pre><code>RegistryKey softwareKey = Registry.LocalMachine.OpenSubKey("Software", true);
  RegistryKey MyKey = softwareKey.CreateSubKey("MyApp");
  RegistryKey  = MyKey.CreateSubKey("MyKey");
  selfPlacingWindowKey.SetValue("instaldateperson", datestr + usrname);     
  </code></pre>
  
  <p>The problem I have when running Visual Studio 2010, is that it will run the app but logged on as me, I am a user and member of local admin group.. however I cannot create the key (despite I am part of local admin group, who have rights to do so). Neither do I know how to do it as a logon as (but its also not what I want since then I would put Adminuser and password inside the code, and I already am admin ?? so why ??)</p>
  
  <p>If this isn't possible at all, are there options for creating registry keys?</p>
  
  <p>Somehow add them to the project or so ??.. I am a bit confused here.</p>