Z.K.
2006-06-13 21:45:03 UTC
I was wondering if someone could tell me how to trap the Return key in
VC++.NET using MFC? I tried using the pretranslatemessage function, but it
either gave me an exception or locked up my PC. Is there a different way to
do it with VC++.NET?
virtual BOOL PreTranslateMessage(MSG* pMsg);
BOOL CT45679View::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
//if return key is pressed or scanned
if((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_RETURN) )
{
//do something
}
Return CT45679View::PreTranslateMessage(pMsg);
}
VC++.NET using MFC? I tried using the pretranslatemessage function, but it
either gave me an exception or locked up my PC. Is there a different way to
do it with VC++.NET?
virtual BOOL PreTranslateMessage(MSG* pMsg);
BOOL CT45679View::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
//if return key is pressed or scanned
if((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_RETURN) )
{
//do something
}
Return CT45679View::PreTranslateMessage(pMsg);
}