First time

This is the first composition of my personal blog, just for test whether if this blog supports the highlight of the code!

Cheers!

 

Take the MFC.h file as example:

 

  1. #define TRUE 1
  2. #define FALSE 0
  3.  
  4. typedef char * LPSTR ;
  5. typedef const char * LPCSTR ;
  6.  
  7. typedef unsigned long  DWORD ;
  8. typedef int            BOOL ;
  9. typedef unsigned char  BYTE ;
  10. typedef unsigned short WORD ;
  11. typedef int            INT ;
  12. typedef unsigned int   UINT ;
  13. typedef long           LONG ;
  14.  
  15. #define WM_COMMAND             0x0111
  16. #define CObjectid              0xffff
  17. #define   CCmdTargetid         1
  18. #define     CWinThreadid       11
  19. #define       CWinAppid        111
  20. #define         CMyWinAppid    1111
  21. #define     CWndid             12
  22. #define       CFrameWndid      121
  23. #define         CMyFrameWndid  1211
  24. #define       CViewid          122
  25. #define         CMyViewid      1221
  26. #define     CDocumentid        13
  27. #define       CMyDocid         131
  28.  
  29. #include <iostream.h>
  30.  
  31. ///
  32. // Window message map handling
  33.  
  34. struct AFX_MSGMAP_ENTRY ;       // declared below after CWnd
  35.  
  36. struct AFX_MSGMAP
  37. {
  38.         AFX_MSGMAP * pBaseMessageMap ;
  39.         AFX_MSGMAP_ENTRY * lpEntries ;
  40. } ;
  41.  
  42. #define DECLARE_MESSAGE_MAP() /
  43.         static AFX_MSGMAP_ENTRY _messageEntries[]; /
  44.         static AFX_MSGMAP messageMap; /
  45.         virtual AFX_MSGMAP* GetMessageMap() const;
  46.  
  47. #define BEGIN_MESSAGE_MAP(theClass, baseClass) /
  48.         AFX_MSGMAP* theClass::GetMessageMap() const /
  49.                 { return &theClass::messageMap; } /
  50.         AFX_MSGMAP theClass::messageMap = /
  51.         { &(baseClass::messageMap), /
  52.                 (AFX_MSGMAP_ENTRY*) &(theClass::_messageEntries) }; /
  53.         AFX_MSGMAP_ENTRY theClass::_messageEntries[] = /
  54.         {
  55.  
  56. #define END_MESSAGE_MAP() /
  57.         { 0, 0, 0, 0, AfxSig_end, (AFX_PMSG)0 } /
  58.         };
  59.  
  60. // Message map signature values and macros in separate header
  61. #include <afxmsg_.h>
  62.  
  63. class CObject
  64. {
  65. public :
  66.   CObject :: CObject ( )   {
  67.                       }
  68.   CObject :: ~CObject ( ) {
  69.                       }
  70. } ;
  71.  
  72. class CCmdTarget : public CObject
  73. {
  74. public :
  75.   CCmdTarget :: CCmdTarget ( )   {
  76.                             }
  77.   CCmdTarget :: ~CCmdTarget ( ) {
  78.                             }
  79.   DECLARE_MESSAGE_MAP ( )       // base class - no {{ }} macros
  80. } ;
  81.  
  82. typedef void ( CCmdTarget :: * AFX_PMSG ) ( void ) ;
  83.  
  84. struct AFX_MSGMAP_ENTRY   // MFC 4.0
  85. {
  86.     UINT nMessage ; // windows message
  87.     UINT nCode ;     // control code or WM_NOTIFY code
  88.     UINT nID ;       // control ID (or 0 for windows messages)
  89.     UINT nLastID ;   // used for entries specifying a range of control id's
  90.     UINT nSig ;     // signature type (action) or pointer to message #
  91.     AFX_PMSG pfn ;   // routine to call (or special value)
  92. } ;
  93.  
  94. class CWinThread : public CCmdTarget
  95. {
  96. public :
  97.   CWinThread :: CWinThread ( )   {
  98.                             }
  99.   CWinThread :: ~CWinThread ( ) {
  100.                             }
  101.  
  102.   virtual BOOL InitInstance ( ) {
  103.                                 cout << "CWinThread::InitInstance /n " ;
  104.                                 return TRUE ;
  105.                               }
  106.   virtual int Run ( ) {
  107.                       cout << "CWinThread::Run /n " ;
  108.                       return 1 ;
  109.                     }
  110. } ;
  111.  
  112. class CWnd ;
  113.  
  114. class CWinApp : public CWinThread
  115. {
  116. public :
  117.   CWinApp * m_pCurrentWinApp ;
  118.   CWnd * m_pMainWnd ;
  119.  
  120. public :
  121.   CWinApp :: CWinApp ( )   {
  122.                         m_pCurrentWinApp = this ;
  123.                       }
  124.   CWinApp :: ~CWinApp ( ) {
  125.                       }
  126.  
  127.   virtual BOOL InitApplication ( ) {
  128.                                     cout << "CWinApp::InitApplication /n " ;
  129.                                     return TRUE ;
  130.                                   }
  131.   virtual BOOL InitInstance ( )     {
  132.                                     cout << "CWinApp::InitInstance /n " ;
  133.                                     return TRUE ;
  134.                                   }
  135.   virtual int Run ( ) {
  136.                       cout << "CWinApp::Run /n " ;
  137.                       return CWinThread :: Run ( ) ;
  138.                     }
  139.  
  140.   DECLARE_MESSAGE_MAP ( )
  141. } ;
  142.  
  143. typedef void ( CWnd :: * AFX_PMSGW ) ( void ) ;
  144.         // like 'AFX_PMSG' but for CWnd derived classes only
  145.  
  146. class CDocument : public CCmdTarget
  147. {
  148. public :
  149.   CDocument :: CDocument ( )   {
  150.                             }
  151.   CDocument :: ~CDocument ( )   {
  152.                             }
  153.   DECLARE_MESSAGE_MAP ( )
  154. } ;
  155.  
  156. class CWnd : public CCmdTarget
  157. {
  158. public :
  159.   CWnd :: CWnd ( )   {
  160.                   }
  161.   CWnd :: ~CWnd ( )   {
  162.                   }
  163.  
  164.   virtual BOOL Create ( ) ;
  165.   BOOL CreateEx ( ) ;
  166.   virtual BOOL PreCreateWindow ( ) ;
  167.  
  168.   DECLARE_MESSAGE_MAP ( )
  169. } ;
  170.  
  171. class CFrameWnd : public CWnd
  172. {
  173. public :
  174.   CFrameWnd :: CFrameWnd ( )   {
  175.                             }
  176.   CFrameWnd :: ~CFrameWnd ( )   {
  177.                             }
  178.   BOOL Create ( ) ;
  179.   virtual BOOL PreCreateWindow ( ) ;
  180.  
  181.   DECLARE_MESSAGE_MAP ( )
  182. } ;
  183.  
  184. class CView : public CWnd
  185. {
  186. public :
  187.   CView :: CView ( )   {
  188.                     }
  189.   CView :: ~CView ( )   {
  190.                     }
  191.   DECLARE_MESSAGE_MAP ( )
  192. } ;
  193.  
  194. // global function
  195. CWinApp * AfxGetApp ( ) ;

 

Look at that, great hal~ Nice going~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值