分享

屏蔽ENTER键、ESC键的使用

 oskycar 2012-06-05
一、添加函数,屏蔽ENTER键和ESC键的使用:
BOOL CBingLi::PreTranslateMessage(MSG* pMsg)
{
   // TODO: Add your specialized code here and/or call the base class
   if(pMsg->message   ==WM_KEYDOWN)  
   {  
      int   nVirtKey   =   (int)pMsg->wParam;   
       if   (nVirtKey==VK_ESCAPE || nVirtKey == VK_RETURN)  
      {   
         return   TRUE;  
      }  
   
   }  
 
   return CDialog::PreTranslateMessage(pMsg);
}
二、添加函数,屏蔽组合键ALT+F4的使用:
BOOL CBingLi::PreTranslateMessage(MSG* pMsg)
{
    // TODO: Add your specialized code here and/or call the base class
    if(pMsg->message   ==WM_KEYDOWN)  
    {  
       int   nVirtKey   =   (int)pMsg->wParam;   
 
        if(pMsg->message==WM_HOTKEY&&pMsg->wParam==0XA002 //屏蔽ALT+F4
       {
           return   TRUE;       //什么都不做  
       }
   
    }  
 
    return CDialog::PreTranslateMessage(pMsg);
} 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多