实现效果:
知识运用:
DisableRegistryTools键 //设置是否允许运行注册表程序
1 表禁止 0 为允许
实现代码:
private void button1_Click(object sender, EventArgs e) { try { RegistryKey rk = Registry.CurrentUser.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"); rk.SetValue("DisableRegistryTools",1,RegistryValueKind.DWord); MessageBox.Show("注册表禁用成功!"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void button2_Click(object sender, EventArgs e) { try { RegistryKey rk = Registry.CurrentUser.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"); rk.SetValue("DisableRegistryTools", 0, RegistryValueKind.DWord); MessageBox.Show("注册表启用用成功!"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }