清除IE地址栏中的历史网址

Posted on 2019-01-31 22:20  努力成长静待花开  阅读(208)  评论(0编辑  收藏  举报

实现效果:

  

知识运用:

  RegistryKey类的GetValueNames和DeleteValue方法

实现代码:

        private void button1_Click(object sender, EventArgs e)
        {
            RegistryKey rk = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Internet Explorer\TypedURLs");
            string[] list = rk.GetValueNames();
            foreach (string s in list)
            {
                rk.DeleteValue(s);
            }
            MessageBox.Show("清除完成!");
        }