首页 > 代码库 > WTL对话框应用程序响应键盘消息

WTL对话框应用程序响应键盘消息

修改对话框程序的PreTranslateMessage()消息

 1 BOOL CMainDlg::PreTranslateMessage(MSG* pMsg) 2 { 3     int nCurSel; 4     if((nCurSel = m_wndOutputList.GetCurSel()) >= 0) 5     { 6         //WCHAR strSource[256]={0}; 7         if(WM_KEYDOWN == pMsg->message) 8         { 9             switch (pMsg->wParam)10             {11             //屏蔽Esc消息12             case VK_ESCAPE:13                 return true;14                 break;15             //组合键Ctrl+C16             case C:17             //case ‘c‘:18                 if((::GetKeyState(VK_CONTROL) < 0))19                 {20                     m_wndOutputList.GetText(nCurSel,strSource);21                 }22                 //组合键Ctrl+Shift+S23             case S:24                 if((::GetKeyState(VK_CONTROL) < 0) && (::GetKeyState(VK_SHIFT) < 0))25                 {26                 }27  28                 break;29             }30         }31     }32     return CWindow::IsDialogMessage(pMsg);33 }

 

WTL对话框应用程序响应键盘消息