MFC BASICS
The MFC is a C++ class library and an application framework for Microsoft Windows. The MFC encapsulate the Windows API in C++ classes. In a MFC application, you donīt need to call the Windows API directly, just creating objects from MFC classes and call member functions belonging to those objects. The MFC offers C++ base classes for the user interface, general- purpose classes for collections, files, persistent storage, diagnostics, memory management, strings, time, and other for creating Windows- based applications (MFC applications) in an object- oriented way.

A part of the MFC class hierarchy is shown in the next figure. At the top is a class called CObject. This base class provides various run- time support features, including run- time type information, serialization, and diagnostics. Many MFC base classes are derived directly from CObject. Some of the most commonly used derived MFC classes are CCmdTarget, CWinApp, CDocTemplate, CWnd, CDocument, CFrameWnd, CView, CDialog, and CMDIFrameWnd. The serialization feature of the MFC base class CObject allows you to build persistent objects. A persistent object store itself on disk or some other type of storage device and be restored later - usually by a subsequent invocation of the program.

In the Windows programming model, applications respond to events by processing messages sent by Windows. An event could be a keystroke, a mouse move, or something else. For message processing, MFC applications use message maps to correlate incoming messages with class member functions. To use a MFC message map, a class must be derived from the MFC top level base class CCmdTarget. This class encapsulates the basics for message processing. Some of the other important MFC base classes are:

  • CWinApp: The CWinApp class is the base class from which you derive a Windows application object. An application object provides member functions for initializing your application and for running the application.
  • CDocTemplate: The CDocTemplate class is derived from the CCmdTarget base class. The MFC class CDocTemplate provides some basic functionality for the MFC document / view architecture and works in conjunction with the CDocument and CView classes.
  • CWnd: The CWnd class provides the base functionality of all window classes in the MFC. The CWnd class encapsulates the properties of a window. This class also provides default handlers for many messages and offers many member functions.
  • CDocument: The CDocument class is derived from the base class CCmdTarget. The CDocument class provides the basic functionality for MFC user- defined document classes. A document is a part of the MFC document / view architecture.
  • CFrameWnd: The CFrameWnd class is derived from the CWnd base class. The CFrameWnd class provides the functionality of a Windows single document interface (SDI) overlapped or pop- up frame window, along with members for managing the window.
  • CView: The CView class is derived from the base class CWnd. The CView class provides the basic functionality for MFC user- defined view classes. A view is a part of the MFC document / view architecture.
  • CDialog: The CDialog class is derived from the base class CWnd. The CDialog class provides the basic functionality of a Windows dialog box window, along with members for managing the window.
  • CMDIFrameWnd: The CMDIFrameWnd class is derived from the CFrameWnd base class. The class CMDIFrameWnd provides the functionality of a Windows multiple document interface (MDI) frame window, along with members for managing the window.

SSV SOFTWARE SYSTEMS PC/104 Products. FPPC MFC PRG. File: P90.HTM, Last Update: 21-Sept-1997
Copyright (c) 1996, 1997 WST. All rights reserved.