WM_KILLFOCUS

This message is sent immediately before a window loses the input focus.

Parameter Description  

wParam Contains the handle of the window that receives the input focus (may be NULL).  
lParam Is not used.  

Comments

If an application is displaying a caret, the caret should be destroyed at this point.