Skip to content

Latest commit

 

History

History
24 lines (17 loc) · 2.63 KB

frame-window-classes-created-by-the-application-wizard.md

File metadata and controls

24 lines (17 loc) · 2.63 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Frame-Window Classes Created by the Application Wizard
Frame-Window Classes Created by the Application Wizard
11/04/2016
CMainFrame
application wizards [MFC], frame window classes created by
window classes [MFC]
classes [MFC], frame-window
CMDIFrameWnd class [MFC], frame windows
window classes [MFC], frame
CFrameWnd class [MFC], frame windows
CMDIChildWnd class [MFC], frame windows
frame window classes [MFC], created by application wizards
CMainFrame class [MFC]
9947df73-4470-49a0-ac61-7b6ee401a74e

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