实现效果:
知识运用:
Registry类的SetValue方法
public static void SetValue (string keyName, string valueName, Object value)
实现代码:
private void button1_Click(object sender, EventArgs e) { Registry.SetValue(@"HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem","DisableTaskMgr",1); Registry.SetValue(@"HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesSystem", "DisableTaskMgr", 1); MessageBox.Show("已成功禁止Windows任务管理器"); } private void button2_Click(object sender, EventArgs e) { Registry.SetValue(@"HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem", "DisableTaskMgr", 0); Registry.SetValue(@"HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesSystem", "DisableTaskMgr", 0); MessageBox.Show("已成功开启Windows任务管理器"); }