I am currently running a Windows 7 x64 machine
.
I have written the following code to add a context menu on right click:
RegistryKey rKey = Registry.ClassesRoot.OpenSubKey("Directory\\Background\\shell", true);
String[] names = rKey.GetSubKeyNames();
foreach (String s in names)
{
System.Windows.Forms.MessageBox.Show(s);
}
RegistryKey newKey = rKey.CreateSubKey("Your Application");
RegistryKey newSubKey = newKey.CreateSubKey("command");
newSubKey.SetValue("", "C:\\Windows\\System32\\notepad.exe");
newSubKey.Close();
newKey.Close();
rKey.Close();
If I repeat the procedure directly on the registry, it works, but not via this.
I am also able to access the registry, as I have added a snippet that tells lists all subkeys that I require, but simply does not add one.