C#使用默认浏览器打开网页的方法
作者:RobinTang 时间:2022-02-16 10:39:34
本文实例讲述了C#使用默认浏览器打开网页的方法。分享给大家供大家参考。具体实现方法如下:
public static bool OpenBrowser(String url)
{
RegistryKey key = Registry.ClassesRoot.OpenSubKey(@"http\shell\open\command\");
String s = key.GetValue("").ToString();
String browserpath = null;
if (s.StartsWith("\""))
{
browserpath = s.Substring(1, s.IndexOf('\"', 1) - 1);
}
else
{
browserpath = s.Substring(0, s.IndexOf(" "));
}
return System.Diagnostics.Process.Start(browserpath, url)!=null;
}
希望本文所述对大家的C#程序设计有所帮助。
标签:C#,浏览器,网页
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
通过Class类获取对象(实例讲解)
2023-05-19 14:12:58
![](https://img.aspxhome.com/file/2023/0/102660_0s.png)
C#基于委托实现多线程之间操作的方法
2022-07-16 23:58:16
Java实现替换PDF中的字体功能
2023-10-04 13:24:17
![](https://img.aspxhome.com/file/2023/0/94320_0s.jpg)
如何使用SpEL表达式实现动态分表查询
2022-01-05 03:09:55
Freemarker中的3种循环模式
2021-11-05 09:47:53
浅谈Android手机的抢红包插件
2021-08-13 01:04:36
![](https://img.aspxhome.com/file/2023/0/104680_0s.png)
Android使用fragment实现左侧导航
2023-10-30 10:02:09
![](https://img.aspxhome.com/file/2023/6/110716_0s.jpg)
IntelliJ IDEA修改新建文件自动生成注释的user名
2021-12-29 04:27:38
![](https://img.aspxhome.com/file/2023/8/69308_0s.png)
java easyUI实现自定义网格视图实例代码
2022-05-16 23:52:54
![](https://img.aspxhome.com/file/2023/0/61920_0s.jpg)
Java语言描述MD5加密工具类实例代码
2021-09-18 07:07:34
网易Java程序员两轮面试 请问你能答对几个?
2023-11-29 10:32:08
springcloud引入spring-cloud-starter-openfeign失败的解决
2022-10-30 19:15:09
![](https://img.aspxhome.com/file/2023/7/110827_0s.png)
SpringBoot实现接口数据的加解密功能
2023-06-30 00:11:01
![](https://img.aspxhome.com/file/2023/8/63008_0s.png)
java启动jar包将日志打印到文本的简单操作
2021-12-05 10:42:21
Java HashMap三种循环遍历方式及其性能对比实例分析
2022-03-22 18:36:45
Spring的自动装配Bean的三种方式
2023-08-24 23:05:15
Android编程实现图片的颜色处理功能示例
2022-10-08 23:15:25
![](https://img.aspxhome.com/file/2023/8/92588_0s.gif)
C#利用Label标签控件模拟窗体标题的移动及窗体颜色不断变换效果
2021-06-22 16:55:51
![](https://img.aspxhome.com/file/2023/8/79038_0s.jpg)
java实现二叉树遍历的三种方式
2021-12-03 06:11:51
![](https://img.aspxhome.com/file/2023/9/84179_0s.jpg)
Java 阻塞队列和线程池原理分析
2022-04-19 11:57:45
![](https://img.aspxhome.com/file/2023/3/81993_0s.png)