Finch
asked on
How do I disable or slow down the mouse?
Is there a method available to disable the mouse or slow the mouse speed down to a very slow movement. My platform is Windows NT 4.0 and I use C++.
Forgot to add that the function that you use to set the new coordinates is SetCurPos.
To get two mouse threshold values and the mouse speed, call:
SystemParametersInfo(SPI_G ETMOUSE,0, &buf,0);
with buf is an array of 3 integers to store these values.
Then change the value of buf, and call:
SystemParametersInfo(SPI_S ETMOUSE,0, &buf,0);
These function is in USER32.LIB (#include winuser.h)
SystemParametersInfo(SPI_G
with buf is an array of 3 integers to store these values.
Then change the value of buf, and call:
SystemParametersInfo(SPI_S
These function is in USER32.LIB (#include winuser.h)
I'm sorry, if you declare:
int buf[3];
then you have to call:
SystemParametersInfo(SPI_G ETMOUSE,0, buf,0);
//not &buf
int buf[3];
then you have to call:
SystemParametersInfo(SPI_G
//not &buf
ASKER
This is a very good answer, but I've tried it already with disappointing results. The cursor did seem to slow down but the best I could get was about a 50% reduction in cursor speed. I tried values from 0 to 300 in the 3rd element (i.e. buf[2] = 0).
Do you know of any way to totally freeze, hide or disable the cursor?
Do you know of any way to totally freeze, hide or disable the cursor?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If all you want to do is freeze the mouse, I know of a much simpler way.
Use:
RECT rect;
POINT point;
GetCursorPos (&point);
rect.top = point.y;
rect.left = point.x;
rect.bottom = point.y;
rect.right = point.x;
ClipCursor (rect);
I think that ought to do it.
Use:
RECT rect;
POINT point;
GetCursorPos (&point);
rect.top = point.y;
rect.left = point.x;
rect.bottom = point.y;
rect.right = point.x;
ClipCursor (rect);
I think that ought to do it.
Then, to allow the cursor to resume moving, do the same thing only in the RECT structure, fill in the screen resolution, i.e. 0, 0, 640, 480.
ASKER
JKR's answer looks like it will work for my situation, THANKS.
1) Set a timer for say 25ms.
2) Get the mouse position with GetCurPos.
3) Store the values in some variables.
4) In the next call to the timer function, get the cursor points again.
5) Calculate the change in x and y values.
6) Divide the change by some number (the larger the number, the slower the mouse will move).
7) Set the new position to the old position plus the change in coordinates divided by the magic number.
Now, I am no professional, my logic is probably flawed somewhere along the line... perhaps I will test it and let you know what happens.