Share via

MFCIE: 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 the Microsoft Internet Explorer. Microsoft Internet Explorer 4.0 is required to run this sample.

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.

Running the Sample

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