Freigeben über


Internet Explorer Interoperability Technology Sample

This sample demonstrates how to automate Microsoft Internet Explorer using managed code. Using the unmanaged InternetExplorer type, the sample demonstrates the methods and events exposed by this class, and illustrates sinking Internet Explorer events in managed code.

For information about using the samples, see the following topics:

To build the sample using the Command Prompt

  1. Open the Command Prompt window and navigate one of the language-specific subdirectories of the sample.

  2. Type msbuild ExplorerCS.sln or msbuild ExplorerJSL.sln, depending on your choice of programming language.

To build the sample using Visual Studio

  1. Open Windows Explorer and navigate to one of the language-specific subdirectories of the sample.

  2. Double-click the icon for ExplorerCS.sln or ExplorerJSL.sln, depending on your choice of programming language, to open the file in Visual Studio.

  3. In the Build menu, select Build Solution. The sample application will be built in the default \bin or \bin\Debug directory.

To run the sample

  1. In the Command Prompt window, navigate to the directory that contains the built executable.

  2. Type Explorer.exe.

  3. Type a website's URL at the command line to open that website.

  4. Press Enter to quit.

    NoteNote

    This sample builds a console application. You must launch and run it using the Command Prompt to view its output.

Requirements

.NET Framework Version: 2.0, 1.1, 1.0

Remarks

This sample uses a reference to SHDocVw.tlb, a COM type library, to gain access to the InternetExplorer type that is defined in that library. When you build the sample, you will notice that the directory where Explorer.exe is built also contains SHDocVw.dll. Copying this DLL allows the common language runtime to load its types without the need to register the DLL in the Global Assembly Cache.

See Also

Reference

System.Runtime.InteropServices

Other Resources

Interoperating with Unmanaged Code