WinForm 禁用和启用 注册表

禁用注册表:

View Code
   RegistryKey rgK = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\System");
                rgK.SetValue("DisableRegistryTools", 1, RegistryValueKind.DWord);
                MessageBox.Show("禁用成功!!!");

启用注册表

View Code
  RegistryKey rgK = Registry.CurrentUser;
                rgK.DeleteSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\System");
                MessageBox.Show("启用成功!!!");

你可能感兴趣的:(WinForm)