Thursday, March 8, 2007

Purpose of MFC Class


CObject

It is the principal base class for the Microsoft Foundation Class Library.

Provides Support for

  • Serialization support
  • Run-time class information
  • Object diagnostic output
  • Compatibility with collection classes

Serialization

  • Serialization is the process of writing or reading an object to or from a persistent storage medium such as a disk file.
  • Used when the data has to be in structured format.
  • Serialize is the method used The Serialize member function, which is defined in the CObject class, is responsible for actually serializing the data necessary to capture an object's current state.

Run-Time class information

  • Used to get the current object during run-time.
  • Uses the IskindOf() function to do this.

Object Diagnostic Output

The Microsoft Foundation Class Library supplies many diagnostic services that make debugging your programs easier. These diagnostic services include macros and global functions that allow you to track your program's memory allocations, dump the contents of objects during run time, and print debugging messages during run time.

Compatibility with collection classes

Collections are used to store any type of object, and retrieve back from the collections

For example if we have a data in database, for every time we need to make a connection to database and retrieve the data, instead of it we may retrieve all the entries from database and store it in collection class

This will somewhat speeds up the performance of an application

MFC Collection Classes

MFC collection classes are categorized briefly as:

I) Array Classes : they are :

1.CByteArray

2.CWordArray

3.CUintArray

4.CStringArray

5.CPtrArray

6.CObArray

II)List Classes :They are-

1.CObList

2.CPtrList

3.CStringList

III)Map Classes:

1.CMapWordToPtr

2.CMapPtrToWord

3.CMapPtrToPtr

4.CMapWordToOb

5.CMapStringToOb

6.CMapStringToPtr

7.CmapStringToString

· List

The list class provides an ordered, nonindexed list of elements, implemented as a doubly linked list. A list has a "head" and a "tail," and adding or removing elements from the head or tail, or inserting or deleting elements in the middle, is very fast.

· Array

The array class provides a dynamically sized, ordered, and integer-indexed array of objects.

· Map (also known as a dictionary)

A map is a collection that associates a key object with a value object.

CCmdTarget

It is the base class for the Microsoft Foundation Class Library message-map architecture.

CCmdTarget include CView, CWinApp, CDocument, CWnd, and CFrameWnd.

  • CWnd class provides the base functionality of all window classes in the Microsoft Foundation Class Library.

  • CView class provides the basic functionality for user-defined view classes.

  • CWinApp class is the base class from which you derive a Windows application object.

  • CDocument class provides the basic functionality for user-defined document classes.

  • 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.

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.

CDataExchange

Supports the dialog data exchange (DDX) and dialog data validation (DDV) routines used by the Microsoft Foundation classes.

CDC

Defines a class of device-context objects.

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.

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.

Some of the most commonly used derived MFC classes are CCmdTarget, CWinApp, CDocTemplate, CWnd, CDocument, CFrameWnd, CView, CDialog, and CMDIFrameWnd.

No comments:

Post a Comment