我重载了CRichEditCtrl类为CMyRichEditCtrl,然后在CMyRichEditCtrl::OnKeyDown()和CMyRichEditCtrl::OnKeyUp()里面分别屏蔽了对基类被重载函数的调用,但是看来不起作用,请高手指教。
谢谢!void CMyRichEditCtrl::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
if(nChar == KEY_CR)
AfxMessageBox("Return key pressed");
//CRichEditCtrl::OnKeyDown(nChar, nRepCnt, nFlags);
}void CMyRichEditCtrl::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
//CRichEditCtrl::OnKeyUp(nChar, nRepCnt, nFlags);
}
谢谢!void CMyRichEditCtrl::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
if(nChar == KEY_CR)
AfxMessageBox("Return key pressed");
//CRichEditCtrl::OnKeyDown(nChar, nRepCnt, nFlags);
}void CMyRichEditCtrl::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
//CRichEditCtrl::OnKeyUp(nChar, nRepCnt, nFlags);
}
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message == WM_KEYDOWN)
{
pMsg->wParam = 0x0; }
return CDialog::PreTranslateMessage(pMsg);
}