Remarks
Internet Explorer 8. On Windows Vista, to create an instance of Internet Explorer running at a medium integrity level, pass CLSID_InternetExplorerMedium (defined in exdisp.idl) to CoCreateInstance. The resulting InternetExplorerMedium object supports the same events, methods, and properties as the InternetExplorer object.
Examples
The following example uses CreateObject in Microsoft Visual Basic to launch an instance of Internet Explorer.
| Dim IE As SHDocVw.InternetExplorer Set IE = CreateObject("InternetExplorer.Application") |
The following C# example launches an instance of Internet Explorer and navigates to a Web page. The code also demonstrates how to create an event handler to listen for the BeforeNavigate2 event. The project requires a reference to the Microsoft Internet Controls (SHDocVw) type library.
| using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class EventHandlers { public void OnBeforeNavigate2(object sender, ref object URL, ref object Flags, ref object Target, ref object PostData, ref object Headers, ref bool Cancel) { Console.WriteLine("BeforeNavigate2 fired!"); } } class Program { static void Main(string[] args) { EventHandlers e = new EventHandlers(); SHDocVw.InternetExplorer IE = new SHDocVw.InternetExplorer(); object Empty = 0; object URL = "http://www.live.com"; // override BeforeNavigate2 event IE.BeforeNavigate2 += new SHDocVw.DWebBrowserEvents2_BeforeNavigate2EventHandler( e.OnBeforeNavigate2); IE.Visible = true; IE.Navigate2(ref URL, ref Empty, ref Empty, ref Empty, ref Empty); System.Threading.Thread.Sleep(5000); IE.Quit(); } } } |
Object Information
| CLSID | CLSID_InternetExplorer |
|---|---|
| Minimum availability | Internet Explorer 4.0 |
| Minimum operating systems | Windows 98, Windows CE 4.0 |







