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:

 

C++语言 : Codee#19538
#define TRUE 1
#define FALSE 0

typedef char * LPSTR ;
typedef const char * LPCSTR ;

typedef unsigned long   DWORD ;
typedef int             BOOL ;
typedef unsigned char   BYTE ;
typedef unsigned short WORD ;
typedef int             INT ;
typedef unsigned int    UINT ;
typedef long            LONG ;

#define WM_COMMAND             0x0111
#define CObjectid              0xffff
#define   CCmdTargetid         1
#define     CWinThreadid       11
#define       CWinAppid        111
#define         CMyWinAppid    1111
#define     CWndid             12
#define       CFrameWndid      121
#define         CMyFrameWndid  1211
#define       CViewid          122
#define         CMyViewid      1221
#define     CDocumentid        13
#define       CMyDocid         131

#include <iostream.h>

///
// Window message map handling

struct AFX_MSGMAP_ENTRY ;       // declared below after CWnd

struct AFX_MSGMAP
{
        AFX_MSGMAP * pBaseMessageMap ;
        AFX_MSGMAP_ENTRY * lpEntries ;
};

#define DECLARE_MESSAGE_MAP() /
        static AFX_MSGMAP_ENTRY _messageEntries[]; /
        static AFX_MSGMAP messageMap; /
        virtual AFX_MSGMAP* GetMessageMap() const;

#define BEGIN_MESSAGE_MAP(theClass, baseClass) /
        AFX_MSGMAP* theClass::GetMessageMap() const /
                { return &theClass::messageMap; } /
        AFX_MSGMAP theClass::messageMap = /
        { &(baseClass::messageMap), /
                (AFX_MSGMAP_ENTRY*) &(theClass::_messageEntries) }; /
        AFX_MSGMAP_ENTRY theClass::_messageEntries[] = /
        {

#define END_MESSAGE_MAP() /
        { 0, 0, 0, 0, AfxSig_end, (AFX_PMSG)0 } /
        };

// Message map signature values and macros in separate header
#include <afxmsg_.h>

class CObject
{
public :
  CObject :: CObject ()  {
                      }
  CObject ::~ CObject () {
                      }
};

class CCmdTarget : public CObject
{
public :
  CCmdTarget :: CCmdTarget ()  {
                            }
  CCmdTarget ::~ CCmdTarget () {
                            }
  DECLARE_MESSAGE_MAP ()       // base class - no {{ }} macros
};

typedef void ( CCmdTarget ::* AFX_PMSG )( void );

struct AFX_MSGMAP_ENTRY   // MFC 4.0
{
    UINT nMessage ; // windows message
    UINT nCode ;    // control code or WM_NOTIFY code
    UINT nID ;      // control ID (or 0 for windows messages)
    UINT nLastID// used for entries specifying a range of control id's
    UINT nSig ;     // signature type (action) or pointer to message #
    AFX_PMSG pfn// routine to call (or special value)
};

class CWinThread : public CCmdTarget
{
public :
  CWinThread :: CWinThread ()  {
                            }
  CWinThread ::~ CWinThread () {
                            }

  virtual BOOL InitInstance () {
                                cout << "CWinThread::InitInstance /n " ;
                                return TRUE ;
                              }
  virtual int Run () {
                      cout << "CWinThread::Run /n " ;
                      return 1 ;
                    }
};

class CWnd ;

class CWinApp : public CWinThread
{
public :
  CWinApp * m_pCurrentWinApp ;
  CWnd * m_pMainWnd ;

public :
  CWinApp :: CWinApp ()  {
                        m_pCurrentWinApp = this ;
                      }
  CWinApp ::~ CWinApp () {
                      }

  virtual BOOL InitApplication () {
                                   cout << "CWinApp::InitApplication /n " ;
                                   return TRUE ;
                                 }
  virtual BOOL InitInstance ()    {
                                   cout << "CWinApp::InitInstance /n " ;
                                   return TRUE ;
                                 }
  virtual int Run () {
                      cout << "CWinApp::Run /n " ;
                      return CWinThread :: Run ();
                    }

  DECLARE_MESSAGE_MAP ()
};

typedef void ( CWnd ::* AFX_PMSGW )( void );
        // like 'AFX_PMSG' but for CWnd derived classes only

class CDocument : public CCmdTarget
{
public :
  CDocument :: CDocument ()   {
                           }
  CDocument ::~ CDocument ()  {
                           }
  DECLARE_MESSAGE_MAP ()
};

class CWnd : public CCmdTarget
{
public :
  CWnd :: CWnd ()   {
                 }
  CWnd ::~ CWnd ()  {
                 }

  virtual BOOL Create ();
  BOOL CreateEx ();
  virtual BOOL PreCreateWindow ();

  DECLARE_MESSAGE_MAP ()
};

class CFrameWnd : public CWnd
{
public :
  CFrameWnd :: CFrameWnd ()   {
                           }
  CFrameWnd ::~ CFrameWnd ()  {
                           }
  BOOL Create ();
  virtual BOOL PreCreateWindow ();

  DECLARE_MESSAGE_MAP ()
};

class CView : public CWnd
{
public :
  CView :: CView ()   {
                   }
  CView ::~ CView ()  {
                   }
  DECLARE_MESSAGE_MAP ()
};

// global function
CWinApp * AfxGetApp ();

 

Look at that, great hal~ Nice going~

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值