Results 1 to 3 of 3

Thread: Determine the Speed and Acceleration settings of the mouse

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2002
    Posts
    3

    Determine the Speed and Acceleration settings of the mouse

    I am trying to determine the average speed a mouse that is moved on a frame on the form.
    Depending on the average speed if the user moves the mouse speeder than the average speed I should display a message about the speed he is using the mouse.

    Is this possible in Visual Basic. I am sure this is possible but I am not knowing which function to use. So any help would be greatly appreciated.

    Thanking you,
    Dinakar Tatineni

  2. #2
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    To get the speed of the mouse, ask the user to move the mouse at a normal speed or something... then make your program test for the position of the mouse twice, with a delay of 100 miliseconds between the two tests (that should be enough). Get the distance between the 2 positions, and then use the general speed formula (Speed = Distance / Time)... that should work

    Do you know about the GetTickCount and the GetCursorPos APIs? You shouldn't rely on the native VB functions, they're not very accurate, try using these functions instead (if you don't know how just search the web there are tons of articles about them and they're not too hard). If you still can't do it by yourself, post here again and I'll help you out...
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2002
    Posts
    3

    Thank you

    Your reply is great. I will work on it

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width