Remove mouse capture and handle visibility via WM_SETCURSOR messages instead of window activation events.