HTMLEdit Sample: Wraps the Internet Explorer MSHTML Editing Control
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 in Internet Explorer Development.
Security Note |
---|
This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties. |
To get samples and instructions for installing them:
To access samples from Visual Studio
On the Help menu, click Samples.
By default, these samples are installed in drive:\Program Files\Microsoft Visual Studio 10.0\Samples\.
- For the most recent version of this sample and a list of other samples, see Visual Studio Samples on the MSDN Web site.
Requirements
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
Open the solution HTMLEdit.sln.
On the Build menu, click Build.
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.
Keywords
This sample demonstrates the following keywords:
CHtmlEditView, CHtmlEditDoc
Note
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.