实现效果:
知识运用:
RegistryKey类的CreateSubKey方法
RegistryKey类的SetValue方法
实现代码:
private void button1_Click(object sender, EventArgs e) { RegistryKey regKey = Registry.CurrentUser.CreateSubKey(@"SoftwareMicrosoftWindowsCurrentVersionPoliciesExplorer"); regKey.SetValue("NoRun",1); MessageBox.Show("禁用"开始"行成功!"); RefreshSystem(); } private void button2_Click(object sender, EventArgs e) { RegistryKey regKey = Registry.CurrentUser.CreateSubKey(@"SoftwareMicrosoftWindowsCurrentVersionPoliciesExplorer"); regKey.SetValue("NoRun", 0); MessageBox.Show("开启"开始"行成功!"); RefreshSystem(); }