Article ID: 125645
Article Last Modified on 11/21/2006
BOOL CMyPropertyPage::PreTranslateMessage(MSG *pMsg)
{
if(pMsg->message==WM_KEYDOWN && pMsg->wParam==VK_RETURN)
{
static const TCHAR szEdit[] = _T("edit");
TCHAR szCompare[sizeof(szEdit)+1];
HWND hFocus = ::GetFocus();
// Check for "edit" controls which want the RETURN key.
// If it doesn't want the return key then let it be
// translated by just calling
// CPropertyPage::PreTranslateMessage
::GetClassName(hFocus, szCompare, sizeof(szCompare));
if (lstrcmpi(szCompare, szEdit) == 0)
{
if(::GetWindowLong(hFocus, GWL_STYLE) & ES_WANTRETURN)
return FALSE; // Don't translate...just send on
// to control
else
return CPropertyPage::PreTranslateMessage(pMsg);
}
// Check for other controls which want the return key
if (::SendMessage(hFocus,WM_GETDLGCODE,0,0) &
(DLGC_WANTALLKEYS | DLGC_WANTMESSAGE))
return FALSE; // Don't translate it
};
return CPropertyPage::PreTranslateMessage(pMsg);
}
Additional query words: 2.00 3.00
Keywords: kbbug kbfix KB125645