Handwritten MFC --- Section 3 Declare

zhaozj2021-02-16  69

First see definition

#define declare_message_map () /

PRIVATE: /

Static const AFX_MSGMAP_ENTRY _MESSAGEENTRIES []; /

protected: /

Static AFX_DATA Const AFX_MSGMAP MessageMap; /

Virtual const AFX_MSGMAP * getMessageMap () const; /

AFX_MSGMAP_ENTRY is a structure

STRUCT AFX_MSGMAP_ENTRY

{

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)

}

AFX_DATA definition

#define AFX_CORE_DATA

#define AFX_DATA AFX_CORE_DATA

AFX_MSGMAP is also a structure

Struct AFX_MSGMAP

{

#ifdef _AFXDLL

Const AFX_MSGMAP * (Pascal * PfNgetBaseMap) ();

#ELSE

Const AFX_MSGMAP * PBASEMAP;

#ENDIF

Const AFX_MSGMAP_ENTRY * LPENTRIES;

}

Let's take a look at the third line.

Static const AFX_MSGMAP_ENTRY _MESSAGEENTRIES [];

Define a static constant AFX_MSGMAP_ENTRY structure name to _MessageEntries

why? No size

From the grammar, a static variable is ok, like:

#include

Class A

{

PUBLIC:

Static const Int Arrdata [];

}

Const Int A :: Arrdata [] = {1, 2, 3, 4, 5};

void main ()

{

Cout << A :: Arrdata [3];

}

转载请注明原文地址:https://www.9cbs.com/read-17049.html

New Post(0)