PDA

Click to See Complete Forum and Search --> : Determine the Speed and Acceleration settings of the mouse


dinacherry_77
Aug 9th, 2002, 04:26 PM
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

Jotaf98
Aug 10th, 2002, 06:56 PM
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...

dinacherry_77
Aug 12th, 2002, 04:07 PM
Your reply is great. I will work on it