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.