The first lecture begins with the MFC "class"
Summary
This clarity will introduce the concept of "class" through a simple MFC application, then analyze its running mechanism and the basic MFC class hierarchy, and finally use the MFC Application Wizard provided by the project template to create a single document program TextViewer. . A simple MFC application
In the current "object-oriented" program, we often have heard the concept of "class" and "objects". So what is "class"? "Class" is essentially a new complex data type. Say it "new" because it is different from the basic data types such as char, int, float in the C language, saying it "complex" because it can not only contain various basic types of data, but also contain processing Data functions.
MFC uses "class" to write a Windows application, such as the following procedure:
(1) Click "New Project" in the Start page, or open "New" in the File menu, select the Project command, will pop up the New Project dialog box.
(2) In the Project Type pane on the left, select "Visual C Project". In the "Template" pane on the right, drag the scroll bar on the right side of the pane to display other templates and select "Win32 Project".
(3) In the Name text box, enter the project name "EX_1_SIMPMFC", click the "OK" button to pop up the Win32 Application Wizard dialog.
(4) Click Application Settings on the left. Select "Windows Application" in "Application Type", select "Empty Project" in "Additional Options", and the result is shown in Figure 1, click the "Finish" button.
Figure 1 Win32 application settings
(5) In "Solution Explorer", right click on the project name EX_1_SIMPMFC, select Add "from the shortcut menu of the pop-up, then select" Add New Item "and pop up the Add New Item dialog.
(6) Select "C file" in the "Template" pane on the right, enter the SIMPMFC in the Name text box, click the "Open".
(7) Type the code as shown in Figure 2.
Figure 2 SIMPMFC.CPP file content
(8) In the "Solution Explorer" tab, right-click on the top of the project name "EX_1_SIMPMFC", select the "Properties" menu item from the pop-up shortcut menu, pop up the "EX_1_SIMPMFC property page" convergence shown in Figure 3 frame.
Figure 3 EX_1_SIMPMFC Properties Page Dialog
(9) Click "MFC Usage", then click the drop-down button on the right, select "Using MFC in Shared DLL" from the pop-up DLL, click the "OK" button.
(10) Open the "Debug" menu, select "Start execution (not debug)", or press CTRL F5, run the program, and the result is shown in Figure 4.
Figure 4 Results of the project EX_1_SIMPMFC