I have "n" dialogs which have the same base dialog. Each dialog has its own controls
In base dialog, how do I set focus messages of each control and,for example, give a Message box with
text("Hello I got focus, my ID is %d")?
According to this SO article, you can hook the WM_SETFOCUS
message.
You can get the Control ID by using GetDlgCtrlID
with the hwnd
returned by the hook.
But beware of popping up a MessageBox
, that will change the focus and trigger your hook proc, making it go into a loop!