MFC,消息接受

在APP中增加PreTranslateMessage()函数。

添加if (CSplashWnd::PreTranslateAppMessage(pMsg))  //你想要的函数。

                   return TRUE;

 

例子:

BOOL CSplashWnd::PreTranslateAppMessage(MSG* pMsg)

{

         if (c_pSplashWnd == NULL)

                   return FALSE;

 

         // If we get a keyboard or mouse message, hide the splash screen.

         if (pMsg->message == WM_KEYDOWN ||

                   pMsg->message == WM_SYSKEYDOWN ||

                   pMsg->message == WM_LBUTTONDOWN ||

                   pMsg->message == WM_RBUTTONDOWN s||

                   pMsg->message == WM_MBUTTONDOWN ||

                   pMsg->message == WM_NCLBUTTONDOWN ||

                   pMsg->message == WM_NCRBUTTONDOWN ||

                   pMsg->message == WM_NCMBUTTONDOWN)

         {

                   c_pSplashWnd->HideSplashScreen();//调用你需要捕获到消息后,想要的功能。

 

       //  c_pSplashWnd是类中一个成员变量。

                   return TRUE;   // message handled here

         }

 

         return FALSE;   // message not handled

}

posted @ 2014-09-02 11:01  学需持  阅读(195)  评论(0编辑  收藏  举报