Rafael,
There are two ways to do it:
1. You may capture the mouse, so all the mouse events get routed to your window, until you release the mouse capture.
2. You may use a timer to call GetCursorPos() to know the mouse position on a certain time interval.