The WM_CAPTURECHANGED message is sent to the window that is losing the mouse capture.
WM_CAPTURECHANGED
hwndNewCapture = (HWND) lParam; // handle of window to gain mouse capture
An application should return zero if it processes this message.
A window receives this message even if it calls ReleaseCapture itself. An application should not attempt to set the mouse capture in response to this message.
When it receives this message, a window should redraw itself, if necessary, to reflect the new mouse-capture state.
Windows NT: Requires version 4.0 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in winuser.h.
Mouse Input Overview, Mouse Input Messages, ReleaseCapture, SetCapture