屏蔽回车键和ESC键

 

BOOL CTMFCDDlg::PreTranslateMessage(MSG* pMsg)
{
    // TODO: Add your specialized code here and/or call the base class

    if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)
    {
        OnBtnlogin();  //当按下回车键执行登录操作
        return TRUE;
    }
    if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE)
    {
        OnCancle();   //当按下ESC键执行取消操作
    }
    return CDialogEx::PreTranslateMessage(pMsg);
}

 

posted @ 2015-08-05 17:06  haihai187  阅读(406)  评论(0编辑  收藏  举报