mouse position capture freezes on drag

how can I read mouse position or deltas while clicking a button or a slider of a scrollbox?
it just works if I move or click on empty spaces but once I click on something like a slider I dont get any mouse movement info. My problem is: I have an image that replaces the mouse pointer and I update its position with mouse coords but when I drag a slider the image stays in place until I release and then jumps to the new updated position.