一、添加函数,屏蔽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);
}