C#怎么实现调用浏览器的功能

本篇内容主要讲解“C#怎么实现调用浏览器的功能”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“C#怎么实现调用浏览器的功能”吧!

C#调用浏览器之调用IE:

System.Diagnostics.Process myProcess = new System.Diagnostics.Process();   myProcess.StartInfo.FileName = "iexplore.exe";  myProcess.StartInfo.Arguments = " http://www.net0and1.com/";  myProcess.Start();

C#调用浏览器之调用默认浏览器:

string target= "http://www.net0and1.com";   //Use no more than one assignment when you test this code.  //string target = "ftp://ftp.microsoft.com";   //string target = "C:\\Program Files\\Microsoft Visual Studio\\INSTALL.HTM";   try {   System.Diagnostics.Process.Start(target);  }  catch (   System.ComponentModel.Win32Exception noBrowser)  {   if (noBrowser.ErrorCode==-2147467259)    MessageBox.Show(noBrowser.Message);  }  catch (System.Exception other)  {    MessageBox.Show(other.Message);  }

到此,相信大家对“C#怎么实现调用浏览器的功能”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!