Re: Getting float values for mouse cursor position by Ray
Ray
Thu Mar 17 16:21:09 CST 2005
About the only ways I know of to do this are:
1) Install a mouclass lower filter to watch for packets.
2) Hmmm. I was going to suggest a low-level mouse hook here, but looking
at the docs again, it claims to be sending the screen coordinates for
each posted mouse event. I thought it was reporting the mickeys sent by
the mouse. So much for that idea (though I guess the docs could be wrong).
3) I think the GetMouseMovePointsEx returns high-res points only for
absolute pointing devices like touchscreens, but it might work for mice.
The docs are unclear, and it's been a long time since I used it myself.
Unless the documentation is wrong, though, a mouse filter driver seems
like the only solution to get raw mickeys from the device.
It's also worth noting that for relative mode mice this is pretty much
only relevant on WinXP+, because the Win2k and lower OS's mouse
ballistics algorithms all had a minimum mapping of 1 "mickey" == 1 pixel.
XP has other issues, too, though, because it converts things that
originally were integers into floating point and accumulates fractional
pixels. I don't think there's any way to find out XP's internal
ballistics state, though. There's a white paper on this at WHDC somewhere.
Géry Casiez wrote:
> Hi,
>
> I use the windows mouse pointer position to control the position of an
> object in my own application. I use GetCursorPos to get the position of the
> pointer on the screen so I get integer values between 0 and the screen
> resolution. For a resolution of 1600x1200, I can only get 1600 possible
> values for x, which is not sufficient for my application. I'm wondering if
> there is any way to get subpixels values, i.e. Is-it possible to get true
> float values for the mouse pointer position?
> (By reducing the mouse sensitivity to the minimum, it's possible to move the
> mouse a few millimeters before moving by one pixel)
>
> Another solution would be to get raw data from the mouse but I'm looking for
> an easier way to do the trick. I also want to try different input devices so
> I prefer to avoid this solution.
>
> Sincerely.
>
> Géry Casiez
>
>
--
../ray\..