Game Development Reference
In-Depth Information
Appendix B:
MFC Document/View
architecture - a short
introduction
Most of the source code in this topic uses Microsoft Foundation Classes
(MFC). If you have never done any MFC programming then you may find
the approach strange. The purpose of this short appendix is to get you
started with MFC programming. If you intend to use MFC in your own
programs then I recommend getting a good MFC book (check Appendix
C for some suggestions); this is just a quick introduction.
Creating a Dialog-based application
When you start up Visual C++ and choose to create a new workspace,
you can select 'MFC AppWizard (exe)' to create an MFC application.
Having chosen your project's name and selected OK, you are faced with
the first of several boxes in the application wizard.
An MFC application can be Single document, Multiple document or
Dialog based. The simplest case is the Dialog-based option.
Any MFC application is derived from the MFC class CWinApp . All MFC
classes use a prefix C to denote a class. A CWinApp class looks after the
basics of an application set-up. CWinApp is in turn derived from
CWinThread . All MFC applications can be made multi-threaded quite
easily by creating a new CWinThread object. In a simple Dialog-based
application the main window is created from a Dialog resource, which can
be visually created using the Visual C++ resource editor. The main
window is shown to the user via the InitInstance function, which is
automatically created in the derived application class by the application
wizard.
Search Nedrilad ::




Custom Search