zoukankan      html  css  js  c++  java
  • 设置IE浏览器的默认主页

    实现效果:
      

    知识运用:
      RegistryKey类的GetValue方法

      public Object GetValue (string name , Object defaultValue)

      name : 要检索的值的名称

      defaultValue: 在name不存在时返回的值 

    实现代码:

            private void Form1_Load(object sender, EventArgs e)
            {
                RegistryKey regMain = Registry.CurrentUser.CreateSubKey(@"SoftwareMicrosoftInternet ExplorerMain");
                object DPage = regMain.GetValue("Start Page","没有值");
                textBox1.Text = DPage.ToString();
            }
            private void button1_Click(object sender, EventArgs e)
            {
                if (!string.IsNullOrEmpty(textBox2.Text))
                {
                    RegistryKey regMain = Registry.CurrentUser.CreateSubKey(@"SoftwareMicrosoftInternet ExplorerMain");
                    regMain.SetValue("Start Page", textBox2.Text);
                    MessageBox.Show("已设置主页为:"+textBox2.Text);
                }
            }
            private void button2_Click(object sender, EventArgs e)
            {
                RegistryKey regMain = Registry.CurrentUser.CreateSubKey(@"SoftwareMicrosoftInternet ExplorerMain");
                regMain.SetValue("Start Page", "about:blank");
                MessageBox.Show("已设置主页为:"+"空白页");
            }
    
  • 相关阅读:
    JDK的KeyTool和KeyStore等加密相关
    关于分布式事务的随笔[待续]
    Netty实例几则
    Disruptor快速入门
    Java获取系统环境信息
    JDK的BIO, NIO, AIO
    四种常用IO模型
    JDK的多线程与并发库
    递归转换为迭代的一种通用方式
    二叉树的java实现
  • 原文地址:https://www.cnblogs.com/feiyucha/p/10344059.html
Copyright © 2011-2022 走看看