Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PreTranslateMessage - Enter ans Escape Keys 1

Status
Not open for further replies.

porto99

Technical User
Nov 1, 2004
96
GB
I have been using the MyTabCtrl from the CoderSource.Net site. To stop the dialog closing when Escape or Enter keys are pressed it says to add the following routine:-

BOOL CTabOne::preTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message==WM_KEYDOWN)
{
if(pMsg->wParam==VK_RETURN || pMsg->wParam==VK_ESCAPE)
pMsg->wParam=NULL ;
}

return CDialog::preTranslateMessage(pMsg);
}

That works fine.

My question is what code do you need to include to get the Escape and Enter keys acting like the Tab key was pressed when the user was in a Edit control.

Many thanks,

Porto.
 
Oo so close...
change
Code:
pMsg->wParam=NULL ;
to
Code:
pMsg->wParam=VK_TAB ;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top