Visual C++ 10.0Visual C++ 9.0Visual C++ 7.1Visual C++ 8.0Visual C++ 7.0Windows 7Visual C++ 6.0AdvancedWindows XPBeginnerIntermediateWindowsC++
CRichEditCtrl Does Not Take the Return





1.00/5 (2 votes)
CRichEditCtrl does not take the return
Introduction
Using the CRichEditCtrl
control in combination with the Dialog creates a small problem like Dialog eats the
return key pressed message. Although I was searching for a simple and quick
solution for that, I have struggled to find a definite answer.
The quickest way to get around that problem is
to override PreTranslateMessage()
function of
a Dialog and just return FALSE
when the return key pressed message is called
for the Rich Edit control...
Just copy/paste:
BOOL EditDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_KEYDOWN)
{
if((pMsg->lParam == IDC_RICHDIALOG_EDIT_ID/*id of a Edit Box*/) &&
(pMsg->wParam == VK_RETURN)
{
return FALSE;
}
}
return CDialogEx::PreTranslateMessage(pMsg);
}