While creating an MFC application, the first step is to define and create the
application’s main window. An Application is allowed to write inside their own
windows only and not in other program windows. A program’s main window is also
referred to as the mainframe which consists of a menu bar, if there is one.
The steps involved can be listed as
1. Create a main window with standard features.
2. Customize other features of the window using a process known as
registering a window class with the operating system.
3. Implement the message handling mechanisms
In your MFC application, you derive your main window or mainframe class from the
MFC class CFrameWnd, which is derived from CWnd; it contains the functionality
needed for a main window. Dialog boxes and controls are also windows, which is
also derived from CWnd.
The application will create an object of the derived mainframe class which will
be the main window object. It can have additional behavior that corresponds to
any member functions that you define in your mainframe class. In addition the
inherited functions from CFrameWnd can be modified by overriding them in your
mainframe class.
Another mandatory class for every MFC application is an application class which
should be derived from the MFC class CWinApp and contains the functionality
needed to set up and run the message loop.
|