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

xiaoxiao2021-04-01  195

HTML window event handling

What is missing in the CHTMLVIEW class?

Typical program processing scripts are assumed to receive events or data inputs from each element (such as button) of the program interface. So in our program, you also need to solve the information interaction between the HTML interface and the MFC background program. We don't have to take a headache. In fact, this problem is not complicated, we can use the OnBeForenaviGate2 function in the ChtmlView class to pass the events in the HTML interface to the MFC background code.

There is also an event in HTML. There are a lot of event models in DHTML.

The occurrence of HTML events can be converted to a call to window.navigate (% line%). The MFC background code can intercept the onbeForenaviGate2 function to the message called by parameter% line%. With parameter% line% We can pass any parameters on any HTML to the MFC background code to facilitate program processing related users. For example, the event is passed to the background when the user clicks the OK button, and the content in the corresponding text box will also be passed to the background. The following is an example:

- Code in the page -

.

.

.