WM_KILLFOCUS is a notification message sent to a window immediately before it loses focus... it doesn't CAUSE it to lose focus. To make something lose focus, tell something else to gain focus via SetFocus(), so the OS knows what to give the focus to. It will then automatically make the control currently in focus lose it, and send it a notification (WM_KILLFOCUS), just in case you need to do something when it no longer has focus.