C# 打开网页兼容Windows8.1的方式

方法:指定浏览器

 1         void WebWithDefaultBrower()
 2         {
 3             string name = string.Empty;
 4 
 5             try
 6             {
 7                 string mainKey = @"http\shell\open\command";
 8                 RegistryKey regKey = Registry.ClassesRoot.OpenSubKey(mainKey);
 9                 name = regKey.GetValue("", @"C:\Program Files\Internet Explorer\IEXPLORE.EXE").ToString();
10 
11                 string[] tmps = name.Split('"');//这里偷个懒用Split
12 
13                 name = tmps[1];
14 
15                 System.Diagnostics.Process.Start(name, "http://www.cnblogs.com/kongfl888");
16             }
17             catch 
18             {
19                 MessageBox.Show("出错了,出错了!",this.Text.ToString ());
20             }
21             
22         }

 

posted @ 2013-09-28 00:47  kongfl888  阅读(210)  评论(0编辑  收藏  举报