最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

c#通过浏览器打开指定网址

业界 admin 4浏览 0评论


导入两个命名空间

using Microsoft.Win32;
using System.Text.RegularExpressions;


打开浏览器

System.Diagnostics.Process.Start("iexplore.exe", "http://www.datangintel/");

打开默认浏览器

             RegistryKey key = Registry.ClassesRoot.OpenSubKey(@"http\shell\open\command\");
             string s = key.GetValue("").ToString();
 
             Regex reg = new Regex("\"([^\"]+)\"");
             MatchCollection matchs = reg.Matches(s);
 
             string filename="";
             if (matchs.Count > 0)   //www.2cto
             {
                 filename = matchs[0].Groups[1].Value;
                 System.Diagnostics.Process.Start(filename, "http://www.datangintel/");
             }



导入两个命名空间

using Microsoft.Win32;
using System.Text.RegularExpressions;


打开浏览器

System.Diagnostics.Process.Start("iexplore.exe", "http://www.datangintel/");

打开默认浏览器

             RegistryKey key = Registry.ClassesRoot.OpenSubKey(@"http\shell\open\command\");
             string s = key.GetValue("").ToString();
 
             Regex reg = new Regex("\"([^\"]+)\"");
             MatchCollection matchs = reg.Matches(s);
 
             string filename="";
             if (matchs.Count > 0)   //www.2cto
             {
                 filename = matchs[0].Groups[1].Value;
                 System.Diagnostics.Process.Start(filename, "http://www.datangintel/");
             }

发布评论

评论列表 (0)

  1. 暂无评论