首先在H文件有如下声明:
class CMultiViewApp : public CWinApp
{
public:
CView* m_pFirstView;
CView* m_pOtherView;
int m_currentView;
CView* m_pView2;
CView* m_pView1;
CMultiViewApp();
// Overrides
// ClassWizard generated virtual function overrides
//{ {AFX_VIRTUAL(CMultiViewApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{ {AFX_MSG(CMultiViewApp)
afx_msg void OnAppAbout();
afx_msg void OnViewOtherview();
afx_msg void OnViewFirstview();
//}}AFX_MSG
afx_msg void OnViewChange(UINT nCmdID);
DECLARE_MESSAGE_MAP()
};
其次,在CPP文件有如下消息MAP:
/
// CMultiViewApp
BEGIN_MESSAGE_MAP(CMultiViewApp, CWinApp)
//{ {AFX_MSG_MAP(CMultiViewApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
ON_COMMAND(ID_VIEW_OTHERVIEW, OnViewOtherview)
ON_COMMAND(ID_VIEW_FIRSTVIEW, OnViewFirstview)
//}}AFX_MSG_MAP
// Standard file based d