I am using Visual Studio 2010, and I am writing a program that should set (and read) new registry values ββin HKLM\Software\myapp
The program is based on .NET 2.0 and currently runs on a 64-bit version of Windows 7. Here is my ocde:
RegistryKey softwareKey = Registry.LocalMachine.OpenSubKey("Software", true); RegistryKey MyKey = softwareKey.CreateSubKey("MyApp"); RegistryKey = MyKey.CreateSubKey("MyKey"); selfPlacingWindowKey.SetValue("instaldateperson", datestr + usrname);
The problem that I encounter when working with Visual Studio 2010 is that it starts the application, but logs in as I do, I am a user and a member of the local administrator group. However, I cannot create the key (despite the fact that I am part of a local administrative group that have rights to this). I also donβt know how to do this as a login (but its also not what I want, since then I would put the Adminuser and password inside the code, and I am already an administrator, so why?)
If this is not possible at all, are there options for creating registry keys?
Somehow add them to the project or so? .. I'm a little confused here.
source share