Re: Detecting the mouse speed

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Alexander Grigoriev (alegr_at_earthlink.net)
Date: 08/28/04

  • Next message: Jeff Partch [MVP]: "Re: Two state button ?"
    Date: Sat, 28 Aug 2004 10:49:02 -0700
    
    

    GetMouseMovePointsEx

    "Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
    news:2qkui01b904l1lpnp7nfc6rhvo4ur3jsle@4ax.com...
    > Well, you can use a global mouse hook to handle the out-of-window problem;
    > at that point
    > you will be able to capture all mouse-move notifications. But hitting the
    > side of the
    > window deifnitely stops the mouse.
    >
    > I have never tried to use a low-level mouse hook, but this might be worth
    > investigating.
    > It might continue to report mouse motion events even though the cursor
    > itself cannot
    > reflect them, but you'd have to check the documentation on this.
    >
    > Also, be wary of what you use for delta-T, since the high-resolution timer
    > cannot be
    > trusted for this (it only records your thread time, not system elapsed
    > time), but the
    > elapsed-time counters have poor resolution,10/15ms (and 55ms on MS-DOS
    > systems).
    >
    > joe
    >
    > On Fri, 27 Aug 2004 20:10:00 +0700, "Alan Carre" <alancarre@hotmail.com>
    > wrote:
    >
    >>Hi,
    >>
    >>Does anyone know a way to detect the speed of the mouse? By that I mean:
    >>how quickly
    >>is the mouse being moved at a given moment. Of course it sounds simple...
    >>take the
    >>current position, take the elapsed time, divide the two and you're done.
    >>The problem
    >>with that is that the mouse will go out of the window eventually or hit
    >>the side of
    >>the screen and stop moving. So it seems that you need to keep re-centering
    >>it's
    >>position.
    >>
    >>I've tried setting the mouse position on every frame back to the screen
    >>center and
    >>seem to be getting random or inconsistent results. Sometimes, even though
    >>I'm moving
    >>the mouse left, I get an occasional glitch where it appears to have moved
    >>right. And
    >>vice versa. I think this may be because I'm setting the mouse position too
    >>often. Not
    >>sure.
    >>
    >>Is there a standard way to just get the speed of the mouse without having
    >>to make
    >>guesses and reset the position continually?
    >>
    >>Thanks
    >>
    >>- Alan
    >>
    >>
    >>
    >
    > Joseph M. Newcomer [MVP]
    > email: newcomer@flounder.com
    > Web: http://www.flounder.com
    > MVP Tips: http://www.flounder.com/mvp_tips.htm


  • Next message: Jeff Partch [MVP]: "Re: Two state button ?"
  • Quantcast