{
// TODO: Add your specialized code here and/or call the base class int MenuCmdId=LOWORD(wParam);//取命令ID
CMenu2View *pView=(CMenu2View*)GetActiveView();//获取当前VIEW类指针
if(MenuCmdId>=IDM_PHONE1 &&
MenuCmdId
CClientDC dc(pView);
dc.TextOut(0,0,pView->m_strArray.GetAt(MenuCmdId-IDM_PHONE1));
return TRUE;
//函数返回,避免调用CFrameWnd::OnCommand函数,在CFrameWnd::OnCommand中截获的消息会交由VIEW类处理 }
return CFrameWnd::OnCommand(wParam, lParam);
//调用基类OnCommand函数,在CFrameWnd::OnCommand中截获的消息会交由VIEW类处理 }
MSDN说明:
virtual BOOL OnCommand( WPARAM wParam, LPARAM lParam ); //The framework calls this member function when the user selects an item from a menu, when a child control sends a notification message, or when an accelerator keystroke is translated.
OnCommand processes the message map for control notification and ON_COMMAND entries, and calls the appropriate member function. Override this member function in your derived class to handle the WM_COMMAND message. An override will not process the message map unless the base class OnCommand is called.
15,LOWORD与HIWORD宏 WORD LOWORD(
DWORD dwValue // value from which low-order word is retrieved );
WORD HIWORD(
DWORD dwValue // value from which high-order word is retrieved );
//The LOWORD macro retrieves the low-order word from the given 32-bit value.
//The HIWORD macro retrieves the high-order word from the given 32-bit value.
16,CFrameWnd::GetActiveView
CView* GetActiveView( ) const;//获取当前视窗口指针(单文档框架中) 17,源文件是单独参与编译的。