Click here to Skip to main content
Click here to Skip to main content
Go to top

Launch and control MSIE using IWebBrowser2

, 28 Nov 2006
Rate this:
Please Sign up or sign in to vote.
A simple interface for launching MSIE and controlling IE components.

Sample output

Introduction

This bit of sample code shows you how to use COM to launch Internet Explorer and through the browser's COM interface control aspects of the browser's interface such as the size of the window, turning on and off the menu bar, the tool bar, and the status bar, and changing the window's icon from the standard Internet Explorer icon to one of your choosing. It also spins IE off in a separate thread from the main thread of the application, and shows you how to determine the browser's version number via the registry.

Using the code

The only thing you should need to use this code is the LaunchBrowser.cpp file, and the prototype "spawn_browser" from that file. In addition, you will need to compile your project with the multi-threaded version of the runtime libraries. I've included a simple console app that shows how to use the interface and call the spawn_browser() function:

spawn_browser("http://www.codeproject.com", 800, 600, hIcon);

Points of Interest

The thread that actually performs the COM interface activity and manipulates the IWebBrowser2 interface is pretty well documented and easy to understand.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

klein_jr
Web Developer
United States United States
John Klein is an experienced C/C++ and C# developer with an emphisis on WiFi and 802.11 systems. John has 19 years of development and management experience and participated in the development of the IEEE 802.11 wireless protocol.
 
John currently works at JiWire, Inc. as a principal engineer.

Comments and Discussions

 
QuestionUpdate the page? PinmemberMember 621128416-May-09 9:24 
AnswerRe: Update the page? PinmemberElveni26-Feb-10 3:26 
GeneralWS_CHILD PinmemberMember 330389115-Jan-09 9:59 
QuestionWhy PinmemberBMW74015-Jan-09 2:40 
QuestionTwo MSIE windows appear on Vista PinmemberTim Brown13-Mar-07 2:24 
AnswerRe: Two MSIE windows appear on Vista Pinmemberdubbele onzin26-Oct-07 21:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 28 Nov 2006
Article Copyright 2006 by klein_jr
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid