DoubleLi

qq: 517712484 wx: ldbgliet

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
[cpp] view plaincopy
 
  1. 这里使用消息拦截的方法  
[cpp] view plaincopy
 
  1. BOOL PersonDlg::PreTranslateMessage(MSG* pMsg)  
  2. {  
  3.     if (GetDlgItem(IDC_EDIT_USER_ID)->m_hWnd == pMsg->hwnd ||  
  4.         GetDlgItem(IDC_EDIT_USER_NAME)->m_hWnd == pMsg->hwnd ||  
  5.         GetDlgItem(IDC_EDIT_PHONE)->m_hWnd == pMsg->hwnd ||  
  6.         GetDlgItem(IDC_EDIT_IDCARD)->m_hWnd == pMsg->hwnd )     
  7.     {     
  8.         if (pMsg->message == WM_RBUTTONUP || pMsg->message == WM_KEYDOWN && pMsg->wParam == 'V' && (GetAsyncKeyState(VK_CONTROL) & 0x8000))              
  9.             return TRUE;          
  10.     }  
  11.     return CRTDialog::PreTranslateMessage( pMsg );  
  12. }  
posted on 2014-04-30 17:24  DoubleLi  阅读(2172)  评论(0编辑  收藏  举报