Thanks in advance.
Cui Sheng
shen...@hotmail.com
How do you know if thats not the case? IOW, how do you know that the focus
is with a particular combobox? Are you calling SetFocus or simply tabbing?
Instead of callign GetDlgCtrlID, see if it matters if you test the window
handle returned by GetFocus with each of the CComboBox objects?
--
Ajay Kalra [MVP - VC++]
ajay...@yahoo.com
"Cui Sheng" <shen...@hotmail.com> wrote in message
news:uX4cpapT...@TK2MSFTNGP12.phx.gbl...
If the focus is in the IDC_EDIT1, push the Enter key, it display message
"IDC_EDIT1"
If the focus is in the IDC_COMBOX1, push the Enter key, it should display
message "IDC_COMBOX1",
but in fact it display "Default : 1001"
Do you know why?
Thanks in advance.
Cui Sheng
shen...@hotmail.com
"Ajay Kalra" <ajay...@yahoo.com> wrote in message
news:O$HicfpTD...@TK2MSFTNGP11.phx.gbl...
If its a CBS_DROPDOWN style combobox, then GetFocus will return the
handle to its child edit control. You'll have to do something with
GetParent.
--
Jeff Partch [VC++ MVP]
--
Ajay Kalra [MVP - VC++]
ajay...@yahoo.com
"Jeff Partch" <je...@mvps.org> wrote in message
news:u1kT59pT...@TK2MSFTNGP12.phx.gbl...
BOOL TestDlg::PreTranslateMessage(MSG* pMsg)
{
if( (pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_RETURN) )
{
if(pMsg->hwnd == GetDlgItem(IDC_EDIT1)->GetSafeHwnd())
{
AfxMessageBox("IDC_EDIT1");
return; // no further processing required!
}
else
if(pMsg->hwnd == GetDlgItem(IDC_COMBOX1)->GetSafeHwnd())
{
AfxMessageBox("IDC_COMBOX1");
return; // no further processing required!
}
else
if(pMsg->hwnd == GetDlgItem(IDC_COMBOX2)->GetSafeHwnd())
{
AfxMessageBox("IDC_COMBOX2");
return; // no further processing required!
}
}
// message not for us, do default:
return CFormView::PreTranslateMessage(pMsg);
}
Try to use controll varibles instead of GetDlgItem, to do this, assign a
control var to the control, then change the
GetDlfItem(...)->GetSafeHwnd()
to
c_myControlVar.GetSafeHwnd()
Joe
#
"Cui Sheng" <shen...@hotmail.com> wrote in message
news:uPQN69p...@TK2MSFTNGP10.phx.gbl...
"Jeff Partch" <je...@mvps.org> wrote in message
news:u1kT59pT...@TK2MSFTNGP12.phx.gbl...