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;
using Microsoft.Win32;

namespace Ex06_10
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            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 button2_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);

        }
    }
}
