August 10th, 2013, 02:53 AM
Moving mouse position
I am writing a program to map keyboard and mouse to an xbox 360 controller with win32 and xinput. I have everything going fine but when im trying to control the mouse with the thumbsticks I get problems with the movement if my program has the focus it moves fine but when I put another window in focus the movement is over sensitive here is the code I am using
I have tried everything to fix it any advice.
if(_controllerState.Gamepad.sThumbRX >= XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE)
profile->Buttons->input.type = INPUT_MOUSE;
profile->Buttons->input.mi.dwExtraInfo = GetMessageExtraInfo();
profile->Buttons->input.mi.time = 0;
profile->Buttons->input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK;
profile->Buttons->input.mi.mouseData = 0;
profile->Buttons->input.mi.dx = mousepos.x * (65535.0f / GetSystemMetrics(SM_CXSCREEN));
profile->Buttons->input.mi.dy = mousepos.y * (65535.0f / GetSystemMetrics(SM_CYSCREEN));
SendInput(1, &profile->Buttons->input, sizeof(INPUT));
August 12th, 2013, 02:48 AM
Re: Moving mouse position
Originally Posted by william3711
In principle, you could move the mouse position with SetCursorPos ... you should can move it, or else you have another issue ..
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!