MFCIE Sample: Demonstrates the MFC CHtmlView and CReBar Classes
The MFCIE sample uses MFC's CHtmlView and CReBar classes to implement a subset of the functionality provided by Microsoft Internet Explorer.
The MFCIE sample provides a view very much like Microsoft Internet Explorer. You can browse to any location on the Web, enter data in forms, print Web pages, download files, or open files on your local hard drive. New addresses can be entered manually in the Address bar of the CReBar control, or hypertext links can be clicked on in the main view.
The sample demonstrates the ease in which a Web browsing capability can be inserted into any application. Most of the functionality of CHtmlView is trivial to implement (for example, GoHome or GoBack), although some of the less obvious features such as printing and font sizing have been implemented for your convenience. The MFCIE sample also demonstrates the proper method of retrieving and reading the Favorites selections and displays them in their own menu.
One thing to note is that the Web browser control used by CHtmlView does its own printing internally, so MFC's printing and Print Preview methods are bypassed entirely.
This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.
Building and Running the Sample
To build and run the MFCIE sample
Open the solution mfcie.sln.
On the Build menu, click Build.
Run the MFCIE application.
MFCIE assumes that you are already connected to the Internet. When it first starts, it will open your home page and you can browse from there just as you would with Microsoft Internet Explorer, either by using the Address bar, the Favorites menu, or by following links on the current page.
This sample demonstrates the following keywords:
CToolBarCtrl::SetButtonWidth; CToolBarCtrl::SetHotImageList; CToolBarCtrl::SetImageList; CReToolBar::SetButtons; CReToolBar::SetButtonInfo; CReToolBar::SetButtonText; CReBar::AddBar; CHtmlView::Navigate2; CAnimateCtrl::Play; CAnimateCtrl::Stop; CAnimateCtrl::Seek; CComboBoxEx::InsertItem; CHtmlView::GoHome; CHtmlView::GoBack; CHtmlView::GoForward; CHtmlView::GoSearch; CHtmlView::Stop; CHtmlView::Refresh; CHtmlView::ExecWB
Some samples, such as this one, have not been modified to reflect the changes in the Visual C++ wizards, libraries, and compiler, but still demonstrate how to complete your desired task.