MFC重点技术

看MFC是暑假的时候了,当时概要地总结了其中的重要技术.现在看看,还是挺有启发性的.
我想转入.NET是将来必定要的,只是现在,年轻的时候,能看看MFC还是好的.
=================================================
MFC TECH:
ONE: CLASS INHERITANCE
        The inheritance hirachy is for Windows frame creation. Its basic base class is CCmdTarget, which is the target of the message loop. Target class derives several basic classes, including CWinThread->CWinApp, CDocument, CWnd->CFrameWnd | ->CView
etc. While creating a frame window application, a CWinApp instance is created and thus calles its InitInstance method to  create a CFrame and generates a window. Also it calls its CWinThread::Run() function to run the message loop and handling.

TWO:RTTI
        RTTI is for MFC dinamically generates objects, for object persistence and depersistence, and for runtime class specification. For RTTI, it defines a CRuntimeClass for the information record, which is actuall a struct, with member variables of ClassName, ObjectSize, ClassSchema, pointer points to its BaseClass CRuntimeClass. As a whole, it defines its linked-list data structure. Macro pairs DECLARE_DYNAMIC vs IMPLEMENT_DYNAMIC, DECLARE_DYNCREATE vs IMPLEMENT_DYNCREATE, DECLARE_SERIAL vs IMPLEMENT_SERIAL are defined for dynamic runtime class specification, dynamic object generation and object variaty serialization.

THREE: MESSAGE MAPPING
        Message mapping is for MFC class message routine. To implement this, a messageMap data structure is defined: struct AFX_MSGMAP{}; which includes a pointer points to it's MessageEntries and a pointer points to its base class MessageMap. As for MessageEntry, actually it's also a struct so called AFX_MSGMAP_ENTRY including the information about that message with such as messageID, control code, controlID, signature type and the routine call.
        Then define DECLARE_MESSAGE_MAP to declare the message map data structure. Its implementation is done by another macro BEGIN_MESSAGE_MAP()--ON_COMMAND()--END_MESSAGEMAP(). ON_COMMAND like macros are those actual message entries.

posted @ 2005-12-09 22:53  xiaoyixy  阅读(435)  评论(0编辑  收藏  举报