.h里面
public: virtual BOOL PreTranslateMessage(MSG* pMsg);
.cpp里面
///-------------------------------------------------------------------------/// 重载消息响应函数///-------------------------------------------------------------------------BOOL CDlg::PreTranslateMessage(MSG* pMsg){ if( pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE ) { return TRUE; } //else if( /*pMsg->message == WM_KEYDOWN &&*/ pMsg->message == WM_ENTERIDLE ) //{ // return TRUE; //} return CDialog::PreTranslateMessage(pMsg);}