The use of PreTranslateMessage() *might* work, but most implementations are incorrect. The other downside is that it permanently ties the child control to the parent. A better solution is to derive a class from CEdit. Override the OnGetDlgCode() method and return DLGC_WANTALLKEYS. Then override the OnChar() method like:
void CMyEdit::OnChar( UINT nChar, UINT nRepCnt, UINT nFlags )
{
switch (nChar)
{
case VK_RETURN:
GetParent()->SendMessage(some_custom_msg, GetDlgCtrlID(), (LPARAM) this);
return;
}
CEdit::OnChar( nChar, nRepCnt, nFlags );
}
When the edit control "sees" the Enter key, it posts a message to the parent indicating such. The parent can then respond accordingly, if at all.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne