How do you add code to these events for native C ++?
I could not find WM_LOSTFOCUS OR WM_GOTFOCUS ; I found WM_SETFOCUS . I need code when my window loses focus and restores it.
WM_LOSTFOCUS
WM_GOTFOCUS
WM_SETFOCUS
Thanks.
ONLY BEFORE your window loses focus, it will be sent: WM_KILLFOCUSAFTER your window receives focus, it will be sent: WM_SETFOCUS
WM_KILLFOCUS
Sending a WM_SETFOCUS message does not set focus. To do this, you need to call SetFocus.
For the edit control, WM_KILLFOCUS will not work.
I thought for too long that I need EN_KILLFOCUS . Hope someone saves the next guy.
The message you are looking for is WM_KILLFOCUS
You may consider WM_ACTIVATE . In the main window, an activation message may be the only solution.