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) &&
(pMsg->wParam == VK_RETURN)
{
return FALSE;
}
}
return CDialogEx::PreTranslateMessage(pMsg);
}