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         }

 

你可能感兴趣的:(windows)