Programming, website development forum Get latest updates by RSS Follow TechnicalTalk on Twitter Follow TechnicalTalk on Facebook 
HomeSearchRecent PostsLoginRegisterContact Us

Username  
Password    
  Forgot your password?  

Pages: [1]   Go Down
 
  Email this topic  |  Print
0 Members and 1 Guest are viewing this topic.

Open a website in Internet Explorer using c#.net

 
webmaster forum
shefeekj  Offline
For Technical Information
Activity
0%
 
New Coder
Posts: 26
Topics: 11
WWW
April 14, 2009, 06:26:38 AM

Here is the code in C#.net to open a website using internet explorer from a    .net application.AN instance of internet explorer is created and the website is accessed using this instance

Note :  Add reference to the DLL   SHDocVw 

 
Code:
using SHDocVw;

object o = null;

SHDocVw.InternetExplorer ie = new SHDocVw.InternetExplorerClass();

IWebBrowserApp wb = (IWebBrowserApp)ie;

wb.Visible = true;

wb.Navigate(url, ref o, ref o, ref o, ref o);

OpenBrowser(”http://www.google.com”);
« Last Edit: April 14, 2009, 06:32:20 AM by polas »

http://www.shefeekj.com
 
webmaster forum
polas  Offline
Activity
33.33%
 
Code Guru
Gender: Male
Posts: 1399
Topics: 85
WWW
April 14, 2009, 06:58:53 AM

Nice post, what about if they use firefox?

Mesham Type Oriented Parallel Programming Language, Free online technical support
 
webmaster forum
shefeekj  Offline
For Technical Information
Activity
0%
 
New Coder
Posts: 26
Topics: 11
WWW
April 14, 2009, 07:07:03 AM

This will launch the system defined default browser:

string url = "http://stackoverflow.com/";
System.Diagnostics.Process.Start(url);

http://www.shefeekj.com
 
webmaster forum
polas  Offline
Activity
33.33%
 
Code Guru
Gender: Male
Posts: 1399
Topics: 85
WWW
April 14, 2009, 07:11:32 AM

Ah right thanks, the system defined browser makes sense Smiley

Mesham Type Oriented Parallel Programming Language, Free online technical support
 
webmaster forum
singam  Offline
Activity
0%
 
Regular Coder
Posts: 50
Topics: 19
June 19, 2010, 12:36:17 AM



    /// <summary>
    /// Opens a new Internet Explorer window and navigates it to the URL.
    /// This code is for demonstration purposes only.
    /// </summary>
    /// <param name="sURL">URL to navigate to. </param>
    /// <returns>true all the time. </returns>
    public static bool IEOpenOnURL (string sURL)
    {
       InternetExplorer oIE = (InternetExplorer)NSLibStatic. COMCreateObject
                                                          ("InternetExplorer. Application");

       if (oIE != null)
       {   
          object oEmpty = String. Empty;
          object oURL= sURL;
          oIE. Visible = true;
          oIE. Navigate2 (ref oURL, ref oEmpty, ref oEmpty, ref oEmpty, ref oEmpty);
       }
       return true;         
    }


==============

Search Engine Optimisation UK | Link Building
 
webmaster forum
Andrew26  Offline
Activity
100%
 
New Coder
Gender: Male
Age: 26
Posts: 15
Topics: 0
WWW
January 28, 2012, 04:39:37 AM

Nice post . . thanks :)

Wholesale Sunglasses
 
webmaster forum
Ricky26  Offline
Activity
100%
 
New Coder
Posts: 15
Topics: 0
WWW
January 30, 2012, 05:19:26 AM

Great post, what about if they use Google chrome?

eGo-C
 
  Email this topic  |  Print
Pages: [1]   Go Up
 
Jump to:  



Powered by SMF 1.1.15 | SMF © 2011, Simple Machines


Google visited last this page February 05, 2012, 12:26:16 PM