use IE6 to show an url

Shows how to start IE6 from a program and display a given URL.

Download iegotourl.zip

Synopsis:

iegotourl.cs
explorer.cs


iegotourl.cs

Synopsis
using System;

	public class iegotourl
	{
    private Explorer mExplorer = new Explorer();
    private string mAddr = "www.microsoft.com";
    
    public iegotourl()
		{
      mExplorer.ShowPage(mAddr);

      //this kills the IE window...
      mExplorer.Dispose();
		}
	}


explorer.cs

Synopsis
using System;
using SHDocVw; //add "Microsoft Internet Controls" from the COM references
using mshtml;  //add "Microsoft.mshtml" from the .Net references

public class Explorer
{
  SHDocVw.InternetExplorer myIExplorer = null;
  IWebBrowserApp myWebBrowser = null;
  public Explorer()
  {
    myIExplorer = new SHDocVw.InternetExplorer();
    myWebBrowser = (IWebBrowserApp) myIExplorer;
    myWebBrowser.Visible = true;         
  }
  public void ShowPage(string addr)
  {
    Object o = null;
    myWebBrowser.Navigate(addr, ref o, ref o, ref o, ref o);
  }
  public void Dispose()
  {
    myWebBrowser.Quit();
  }
}






Contact me about content on this page using john_web-at-arrizza-dot-com
For Web Master or site problems contact: webadmin-at-arrizza-dot-com
Copyright John Arrizza (c) 2001,2002,2003,2004,2005,2006,2007