MFC(7)

2019-03-15 13:46

{

// 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 &&

MenuCmdIdm_strArray.GetSize())//消息范围判断 {

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,源文件是单独参与编译的。


MFC(7).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:唯众物联网智能家居工程实训室(平台) - 图文

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: