using Microsoft.Win32; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace LockIE { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { RegistryKey reg = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Microsoft\Internet Explorer\MAIN"); //当键值名为“HomePage”的键值修改为“1”,则禁止修改IE主页 reg.SetValue("Start Page", 1, RegistryValueKind.String); //提示对话框 MessageBox.Show(this, "禁止修改IE主页设置成功!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information); StrURL.Text.Trim(); } private void button2_Click(object sender, EventArgs e) { //自定义RegistryKey对象实例 RegistryKey reg = Registry.CurrentUser.CreateSubKey(@"SoftWare\Policies\Microsoft\Internet Explorer\Control Panel"); //当键值名为“HomePage”的键值修改为“1”,则禁止修改IE主页 reg.SetValue("HomePage", 1, RegistryValueKind.DWord); //提示对话框 MessageBox.Show(this, "禁止修改IE主页设置成功!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information); } private void button3_Click(object sender, EventArgs e) { RegistryKey reg = Registry.CurrentUser.CreateSubKey(@"SoftWare\Policies\Microsoft\Internet Explorer\Control Panel"); //当键值名为“HomePage”的键值修改为“0”,则启动IE浏览器主页的修改 reg.SetValue("HomePage", 0, RegistryValueKind.DWord); //提示对话框 MessageBox.Show(this, "已启动IE浏览器主页的修改!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information); } private void button4_Click(object sender, EventArgs e) { Close(); } } }