Mar 22, 2017 at 6:26pm Mar 22, 2017 at 6:26pm UTC
I did this code:
void MouseMove (int x, int y )
{
double fScreenWidth=::GetSystemMetrics( SM_CXSCREEN )-1;
double fScreenHeight::GetSystemMetrics( SM_CYSCREEN )-1;
double fx = x*(65535.0f/fScreenWidth);
double fy = y*(65535.0f/fScreenHeight);
INPUT Input={0};
Input.type=INPUT_MOUSE;
Input.mi.dwFlags=MOUSEEVENTF_MOVE|MOUSEEVENTF_ABSOLUTE;
Input.mi.dx = fx;
Input.mi.dy = fy;
::SendInput(1,&Input,sizeof(INPUT));
}
This code work, but if i start to play it doesn't work
Mar 22, 2017 at 7:02pm Mar 22, 2017 at 7:02pm UTC
Check the return value from SendInput.
I suspect that it will only work when the mouse is inside your window.
Mar 23, 2017 at 1:52pm Mar 23, 2017 at 1:52pm UTC
It work in the game menu, when there is the cursor, but if i start to play and the cursor disappears it's doesn't work
Mar 23, 2017 at 4:40pm Mar 23, 2017 at 4:40pm UTC
There is only one mouse for the whole system. If the mouse is inside your window the mouse "belongs" to your program and you can move it.
If the mouse if outside your window it means the mouse "belongs" to a other program and so you can't move/hide it.
Mar 26, 2017 at 8:58am Mar 26, 2017 at 8:58am UTC
No, it works, just need to remove |MOUSEEVENTF_ABSOLUTE