实现效果:
  

知识运用:
  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(@"Software\Microsoft\Internet Explorer\Main");
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(@"Software\Microsoft\Internet Explorer\Main");
regMain.SetValue("Start Page", textBox2.Text);
MessageBox.Show("已设置主页为:"+textBox2.Text);
}
}
private void button2_Click(object sender, EventArgs e)
{
RegistryKey regMain = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Internet Explorer\Main");
regMain.SetValue("Start Page", "about:blank");
MessageBox.Show("已设置主页为:"+"空白页");
}

设置IE浏览器的默认主页的更多相关文章

  1. 设置IE浏览器的默认下载路径

    实现效果: 知识运用: Default Download Directory键 实现代码: private void button2_Click(object sender, EventArgs e) ...

  2. WIN10:IE浏览器的默认主页以及通过链接搜索的默认引擎

    主页设置: 地址栏搜索引擎:

  3. IIS设置默认主页无效

    服务器系统:Windows server 2008 R2 IIS版本:7.5 IIS中部署一个dotnet framework 3.5的网站应用程序,设置"默认文档"为:index ...

  4. 微软更新导致的IIS7设置默认主页无效

    近期两个superKM的老客户出现问题,网站不能自动检索默认文档,必须通过完整网址才能访问. 值得一提的是出现问题的都是 IIS7 和7.5版本,服务器为windows server2008 R2. ...

  5. RK3288 修改浏览器默认主页和书签

    path:packages/apps/Browser/res/values/strings.xml 修改浏览器默认主页: <!-- The default homepage. --> &l ...

  6. Nginx+Tomcat多站点访问默认主页问题-狒狒完美解决-Q9715234

    <Engine name="Catalina" defaultHost="www.abc.com"> <Host name="www ...

  7. 修改apache默认主页,重定向404页面

    yum 下载apache后默认主页 默认配置文件: vim /etc/httpd/conf/httpd.conf /etc/httpd/conf.d/welcome.conf 跳转页面到 /var/w ...

  8. 修改TOMCAT默认主页

    1.默认的项目都在目录:apache-tomcat-9.0.0.M22\webapps\ROOT下 2.该目录下有一个index.jsp是tomcat的默认主页,如下 3.现在需要修改这个默认主页,改 ...

  9. 纯 JS 设置文本框的默认提示

    HTML5 中有个新特性叫 placeholder,一般用它来描述输入字段的预期值,适用于 text.search.password 等类型的 input 以及 textarea.示例如下: < ...

随机推荐

  1. mysql 语句执行的过程

    客户端发送一条查询给服务器: 服务器先检查查询缓存,如果命中了缓存,则立刻返回存储在缓存中的结果.否则进入下一阶段. 服务器段进行SQL解析.预处理,在优化器生成对应的执行计划: mysql根据优化器 ...

  2. cloudemanager安装时出现ProtocolError: <ProtocolError for 127.0.0.1/RPC2: 401 Unauthorized>问题解决方法(图文详解)

    不多说,直接上干货! 问题详情 查看日志/var/log/cloudera-scm-agent/,得知 解决办法 $> ps -ef | grep supervisord $> kill ...

  3. How to install local .deb packages

    如何安装本地的.deb包 usually I do dpkg -i <deb file>, it'll fail saying it needs dependencies. After t ...

  4. pinyin4j的基本使用

    PinYin4jUtils工具类代码:http://www.cnblogs.com/jepson6669/p/8856082.html maven中引入依赖 <!-- 引入pinyin4J的依赖 ...

  5. Android NDK 安装与配置

    本文主内容: 1.  Android NDK 安装 2.  安装Cygwin与使用NDK编译 3.  在Eclipse中集成C/C++开发环境CDT 4.  安装Sequoyah插件 5.  JNI编 ...

  6. centOS查看apache版本的命令

    在centOS 7下: 命令如下: httpd -v

  7. java并发编程 - Exexctors 工具类

    Executors 类提供了一系列静态工厂方法用于创建各种线程池. newFixedThreadPool 创建固定大小的线程池.每次提交一个任务就创建一个线程,直到线程达到线程池的最大大小.线程池的大 ...

  8. MsysGit下GUI乱码问题解决

    在Windows下安装Git-preview-1.7.4后,使用中发现许多的乱码问题,感觉甚是不便.这是因为Git是在linux下开发的管理软件,而linux的编码方式是基于UTF-8的,所以移植到W ...

  9. C# 类型、对象、线程栈和托管堆在运行时的关系

    我们将讨论类型.对象.线程栈和托管堆在运行时的相互关系,假定有以下两个类定义: internal class Employee    {        public int GetYearsEmplo ...

  10. [LeetCode]29. Divide Two Integers两数相除

    Given two integers dividend and divisor, divide two integers without using multiplication, division ...