The third part of Windows programming: analysis of MFC framework program

What is the MFC framework program?

MFC framework program

The MFC framework program is a Windows application program generated using the MFC AppWizard.
MFC AppWizard is a wizard tool that assists us in generating source code. It can help us automatically generate source code based on the MFC framework. In each step of the wizard, we can choose various features according to our needs, so as to realize customized applications.

How to create a new MFC program

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

A Preliminary Study of MFC Single Document Interface Program

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

Analysis of MFC framework program (operation context)

Windows API program review
Insert picture description here
MFC framework

Compared with Windows API programs, MFC programs have no execution path, no organization, and no idea how to process messages.

Insert picture description here

MFC program output HelloWorld
Insert picture description here
MFC put the source code package in the VC installation directory

Insert picture description here

Profiling

  1. TheApp, the global object in MFC

Initialize the CTestAPP object, obtain the configuration of the application memory and call the base class CWinApp constructor (AppCore.cpp in the file of the MFC source directory) for some initialization work when the program runs.

note: Since theApp is a global object, the CWinApp constructor will run before the entry function WinMain.

  1. WinMain function in MFC
    Insert picture description here
    (2) AfxWinMain function
    Insert picture description here
  2. CTestApp :: InitInstance () function
    Insert picture description here
  3. CFrameWnd :: LoadFrame function
    Insert picture description here
    Insert picture description here
  4. CWnd::CreateEx
    Insert picture description here
Published 123 original articles · Likes 91 · Visitors 10,000+

Guess you like

Origin blog.csdn.net/weixin_43092232/article/details/105529026