Look into the GetCursorPos and the TrackMouseEvent API functions...

Hope this helps.
Laterz