How can I get the ID of the dialog item which own the focus?
-
:confused: My program can not use the mouse, And all the operation will be done by the keyboard. But I do not know how to get the ID number of the item which has the keyboard focus. Thanks!
pantao551 wrote: item which has the keyboard focus. Use
GetFocus()
to find the Ctrl which currently under the Keyboard Focus. pantao551 wrote: how to get the ID number Pass theHWND
orCWnd
return from call ofGetFocus
toGetDlgCtrlID
which will return the Numeric ID of Control!"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta
-
:confused: My program can not use the mouse, And all the operation will be done by the keyboard. But I do not know how to get the ID number of the item which has the keyboard focus. Thanks!
What Alok said, with the addition that you can use
int id = ::GetWindowLong(::GetFocus(), GWL_ID);
if you'd like to stay win32. -- Schni Schna Schnappi! Schnappi Schnappi Schnapp!