How to create registry key in Windows VISTA OS ?
-
Hi All I want to create below key in Vista OS in my C# application. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System After the key creation i want to write NoDispCPL (DWORD)value to 1. On vista onwards i am anable to create the key. Can any one help ? Thanking You, Sunil G.
-
Hi All I want to create below key in Vista OS in my C# application. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System After the key creation i want to write NoDispCPL (DWORD)value to 1. On vista onwards i am anable to create the key. Can any one help ? Thanking You, Sunil G.
-
Hi, I am using below method to write value RegistryKey myRegKey = Registry.CurrentUser; myRegKey = myRegKey.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"); Registry.SetValue(myRegKey.ToString(), "NoDispCPL", 123, RegistryValueKind.DWord); Regards, Sunil G.
-
Hi, I am using below method to write value RegistryKey myRegKey = Registry.CurrentUser; myRegKey = myRegKey.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"); Registry.SetValue(myRegKey.ToString(), "NoDispCPL", 123, RegistryValueKind.DWord); Regards, Sunil G.
-
Hi, what you do exactly mean by "unable to create" ? Is there an error, or do you don't find the key in registry? This article might help in last case: Windows Vista inbuilt sandbox registry[^] Hope it helps bye
-
Hi, I am not getting any error and also registry is not created. Exe is runing under system account. If I run as an administrator then only it creates the registry. Regards, Sunil G.
-
Hi, did you try do read the key by your program or with regedit? Try to read it by your program ;-) bye
-
Hi, I am not getting any error and also registry is not created. Exe is runing under system account. If I run as an administrator then only it creates the registry. Regards, Sunil G.
-
Hi, I am using below method to write value RegistryKey myRegKey = Registry.CurrentUser; myRegKey = myRegKey.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"); Registry.SetValue(myRegKey.ToString(), "NoDispCPL", 123, RegistryValueKind.DWord); Regards, Sunil G.
Some people have suggested that the UAC might be the problem here, and it could be if you don't force your application to be run under the admin account. But, try this as well: When you open the myRegKey make sure you open it for both reading AND writing. This is done by using the
OpenSubKey
method like this:myRegKey = myRegKey.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", true);
(You left out the second parameter..) Good luck! -
Some people have suggested that the UAC might be the problem here, and it could be if you don't force your application to be run under the admin account. But, try this as well: When you open the myRegKey make sure you open it for both reading AND writing. This is done by using the
OpenSubKey
method like this:myRegKey = myRegKey.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", true);
(You left out the second parameter..) Good luck!