原文:
BEGIN_MESSAGE_MAP(CMy1Dlg, CDialog)
//{{AFX_MSG_MAP(CMy1Dlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
AFX_MSG_MAP ,这个宏是MFC用来构造消息映射表时用到的辅助宏,它埋在类识别宏或动态识别宏中
BEGIN_MESSAGE_MAP(CMy3View, CFormView)
//{{AFX_MSG_MAP(CMy3View)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CFormView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CFormView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CFormView::OnFilePrintPreview)
END_MESSAGE_MAP()
//{{AFX_DATA(CMy4Dlg)
enum { IDD = IDD_MY4_DIALOG };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
public:
//{{AFX_DATA(CMy3View)
enum{ IDD = IDD_MY3_FORM };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
//{{AFX_DATA_MAP 组件数据与组件间的映射
Afx_MSG
发现注释AFX_MSG_MAP和AFX_DATA等宏不能删除,无论在基于对话框还是SDI,MDI中都不能删除,否则将出现cannot add new member 等错误,或双击控件不能进入事件处理。编译器需要!(VC6中,VC2010木有这些)