Sign in to follow this  

Mouse problem solved

This topic is 4557 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I posted a while back because I was having trouble getting some game code in progress to run on my new pc. I finally upgraded from an old 900 mgh machine to a new 3 gig one. But my mouse was jumping all over the place. I previously had code within do loops that looked partially like this: // get the input from the mouse lpdimouse->GetDeviceState(sizeof(DIMOUSESTATE), (LPVOID)&mouse_state); // move the mouse cursor mouse_x+=(mouse_state.lX); mouse_y+=(mouse_state.lY); This worked fine on my old machine, but not the new one. It basically tracked the mouse cursor in order to determine which button the user pressed. I couldn't figure out what was going on. Through some trial and error, I found the addition of this line solved my problem: // get the input from the mouse lpdimouse->GetDeviceState(sizeof(DIMOUSESTATE), (LPVOID)&mouse_state); // move the mouse cursor mouse_x+=(mouse_state.lX); mouse_y+=(mouse_state.lY); SetCursorPos(mouse_x, mouse_y); By re-setting the cursor position everytime through the loop, the mouse now moves as it should without jumping around the screen. I'm still not exactly sure why the old code didn't work on the new box, but maybe this might save someone else some grief. I hope so. Slider

Share this post


Link to post
Share on other sites

This topic is 4557 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this