Rediģēt

Kopīgot, izmantojot


Frame-Window Classes Created by the Application Wizard

When you to create a new MFC project from the New Project dialog, in addition to application, document, and view classes, the Application Wizard creates a derived frame-window class for your application's main frame window. The class is called CMainFrame by default, and the files that contain it are named MAINFRM.H and MAINFRM.CPP.

If your application is SDI, your CMainFrame class is derived from class CFrameWnd.

If your application is MDI, CMainFrame is derived from class CMDIFrameWnd. In this case CMainFrame implements the main frame, which holds the menu, toolbar, and status bars. The Application Wizard does not derive a new document frame-window class for you. Instead, it uses the default implementation in CMDIChildWnd Class. The MFC framework creates a child window to contain each view (which can be of type CScrollView, CEditView, CTreeView, CListView, and so on) that the application requires. If you need to customize your document frame window, you can create a new document frame-window class (see Adding a Class).

If you choose to support a toolbar, the class also has member variables of type CToolBar and CStatusBar and an OnCreate message-handler function to initialize the two control bars.

These frame-window classes work as created, but to enhance their functionality, you must add member variables and member functions. You may also want to have your window classes handle other Windows messages. For more information, see Changing the Styles of a Window Created by MFC.

See also

Frame-Window Classes
MFC Program or Control Source and Header Files