This documentation is archived and is not being maintained.

HTMLEdit Sample: Wraps the Internet Explorer MSHTML Editing Control 

Download sample

The HTMLEdit sample shows how to use the MFC classes that wrap the Internet Explorer WebBrowser ActiveX control. In editing mode, the WebBrowser ActiveX control exposes what you see is what you get (WYSIWYG) editing functionality. The MFC library provide classes (CHtmlEditView and CHtmlEditDoc) that host the MSHTML editing control in a window class and provide convenient wrapper classes for the control's properties, methods, and events.

For more information on the WebBrowser ActiveX control, see WebBrowser Control and Reusing MSHTML in MSDN Web Workshop.

Security noteSecurity Note

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.


You must install Internet Explorer version 5 or later to get the proper editing functionality in the WebBrowser ActiveX control.

Building and Running the Sample

To build and run the HTMLEdit sample

  1. Open the solution HTMLEdit.sln.

  2. On the Build menu, click Build.

  3. Run the HTMLEdit application.

HTMLEdit opens a simple SDI application similar in appearance to Notepad. The user can enter text in the view and then apply different HTML formats using either the toolbar or by hand.


This sample demonstrates the following keywords:

CHtmlEditView, CHtmlEditDoc


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.

See Also

Other Resources

MFC Samples