Enrico,
But TrackMouseEvent( ::hWnd, TME_LEAVE ) is called with TME_LEAVE parameter, so it just notifies when the mouse leaves the control, not when the mouse is moved.
Anyhow, an error like the one that you describe looks as a recursive call that forces the operating system to quit the task