Hello Frank,
Modern OS's have two relatively new window messages,
WM_MOUSEHOVER and
WM_MOUSELEAVE, that work in conjunction with the
TrackMouseEvent() WinAPI to generate the events that you're trying to emulate with SetCapture()/ReleaseCapture().
Prefer to use this new functionality because SetCapture()/ReleaseCapture() are notorious for breaking the natural flow of Windows events in a window callback function and are cumbersome in very many situations.
Please read up on these messages in MSDN and/or elsewhere and try to use them in your code. If you fail to do that yourself, I can help you out with fixing it later on.
Have fun!