$74128
The main application class in MFC encapsulates the initialization, running, and termination of an a
The main application class in MFC encapsulates the initialization, running, and termination of an application for the Windows operating system. An application built on the framework must have one and only one object of a class derived from CWinApp. This object is constructed before windows are created.
is derived from , which represents the main thread of execution for your application, which might have one or more threads. In recent versions of MFC, the , Run, , and member functions are actually in class . These functions are discussed here as if they were members instead, because the discussion concerns the object's role as application object rather than as primary thread.
Like any program for the Windows operating system, your framework application has a function. In a framework application, however, you do not write . It is supplied by the class library and is called when the application starts up. performs standard services such as registering window classes. It then calls member functions of the application object to initialize and run the application. (You can customize by overriding the member functions that calls.)
To initialize the application, calls your application object's and member functions. To run the application's message loop, calls the Run member function. On termination, calls the application object's member function.
General MFC Topics
CWinApp and the MFC Application Wizard
Overridable CWinApp Member Functions
Special CWinApp Services