class CMyStatic : public CStatic
{
// Construction
public:
CMyStatic();// Attributes
public:// Operations
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyStatic)
//}}AFX_VIRTUAL// Implementation
public:
virtual ~CMyStatic(); // Generated message map functions
protected:
//{{AFX_MSG(CMyStatic)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG DECLARE_MESSAGE_MAP()
};
1、// Attributes、// Operations、// Overrides、// Implementation这四个区域,分别指什么?
2、每一个继承mfc的类都有DECLARE_MESSAGE_MAP()吗,为什么?

解决方案 »

  1.   

    1、看金山糍粑。2、声明消息映射表;与begigmessagemap、endmessagemap共同构建消息映射表,这样才能使得你的类收到windows消息。
      

  2.   

    有消息的才有DECLARE_MESSAGE_MAP()搂主挺认真
      

  3.   

    不是MFC的每个class都有message mapping,所以需要接收消息的类才有DECLARE_MESSAGE_MAP
      

  4.   

    1、// Attributes、// Operations、// Overrides、// Implementation这四个区域,分别指什么?
    学点英语没有坏处:属性、操作(方法)、重载、声明,这些是注释,对程序没有作用。2、每一个继承mfc的类都有DECLARE_MESSAGE_MAP()吗,为什么?
    不一定,只有有消息循环的类才需要。比如CDocument就没有。
      

  5.   

    1. 你在某一个MFC函数上, 章击F12进入MFC代码, 就可以看到MFC是如何区分的.
    2. 如果你的派生类不需要消息循环, 可以不要DECLARE_MESSAGE_MAP(),
      事实上控件没有不要消息循环的.