Call ReleaseCapture (which triggers WM_CAPTURECHANGED) after the WM_COMMAND for the button has been sent, rather than before.