انجام عملیات متداول در رجیستری ویندوز
کد:
using Microsoft.Win32;
کد:
// <font color="RoyalBlue"><b>Create SubKey</b></font>
Registry.LocalMachine.CreateSubKey(@"Software\Sinp in",
RegistryKeyPermissionCheck.ReadWriteSubTree);
//<b><font color="RoyalBlue">Create Key and Set Value</font></b>
RegistryKey reg = Registry.LocalMachine.OpenSubKey(@"Software\Sinpin ", true);
reg.SetValue("DWord", "1", RegistryValueKind.DWord);
reg.SetValue("ExpandString", "1", RegistryValueKind.ExpandString);
reg.SetValue("QWord", "1", RegistryValueKind.QWord);
reg.SetValue("String", "1", RegistryValueKind.String);
reg.SetValue("Unknown", "1", RegistryValueKind.Unknown);
//<font color="Red"> <font color="RoyalBlue"><b>Delete Key</b></font></font>
reg.DeleteValue("DWOrd");
//<b><font color="RoyalBlue"> Delete SubKey</font></b>
Registry.LocalMachine.DeleteSubKey(@"Software\Sinp in");
// <b><font color="RoyalBlue">Read Key Value</font></b>
string val = reg.GetValue("QWord").ToString();
// <font color="RoyalBlue"><b>Retrieve All Keys</b></font>
foreach (string s in reg.GetValueNames())
MessageBox.Show(s);