Create a web style graphical user interface in the MFC programming (3)

xiaoxiao2021-03-31  210

Display HTML format with a ChtmlView class

We need to make some changes in the HTML code in the program interface, allowing them to look slightly different from IE.

It is easy to display HTML format in the MFC program. Just we need to call the ChtmlView class to complete this work. First we have to create a new "MFC AppWizard (EXE)" project, select a single document structure view and open Multi-Document Document View Structure Support. Then create and set the ChtmlView class to the base class in the Class Wizard. Finally, add the page of the HTML format to the system resource.

In order to make our web interface look more like a program interface rather than the IE window, the code for the HTML page must do some necessary modifications.

♦ Set the color of the HTML background to the color of the standard Windows application background.

♦ Disable the right-click menu of the HTML page unless the right-click menu used in the Editbox box.

♦ Prohibiting the text in the HTML page is in the mouse box, like, the text exceptions in the Editbox box.

♦ To change the shape when the mouse pointer is static text, in IE, the mouse pointer will become a "work" shape when the mouse pointer is static text, and this is true in the Editbox box. This phenomenon in Windows applications should be avoided.

The following code achieves the above four items: