C#調用瀏覽器的功能實現淺析
作者:佚名
C#調用瀏覽器的功能實現使用了什么方法?C#調用瀏覽器的功能實現的步驟是什么呢?那么本文就向你介紹C#調用瀏覽器包括默認和非默認瀏覽器的基本情況。
C#調用瀏覽器是如何實現的呢?我們在實際的開發過程中會遇到這樣的需求,那么來實現C#調用瀏覽器會用到什么方法呢?這里向你介紹了調用IE以及默認瀏覽器的具體操作。
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#調用瀏覽器的操作就向你介紹到這里,希望對你了解和學習使用C#調用瀏覽器有所幫助。
【編輯推薦】
責任編輯:仲衡
來源:
天極網