Click to See Complete Forum and Search --> : Anyone tell me how a CComboBox can capture a WM_CHAR ?


Johnny DeMichael
May 7th, 1999, 08:18 PM
I derived MyComboBx from CComboBox and added a message map entry to catch a WM_CHAR, the resulting function never gets called . . . (?) Appreciate any input from you experts. Thanks! JD

Bob Clarke
May 7th, 1999, 09:31 PM
Create a variable for tracking when the combo box has focus. Let's call it m_bFocus.

Map messages for CBN_SETFOCUS and CBN_KILLFOCUS. In the SetFocus handler, set m_bFocus to true; in the KillFocus handler, set m_bFocus to false.

Map PreTranslateMessage and in that function, place code like the following:

if(pMsg->message == WM_CHAR && m_bFocus)
{
// do soemthing now that you have the char
}

Johnny DeMichael
May 8th, 1999, 08:44 AM
eom