I am moving the mouse using INPUT to set the cursor position. This is fine, except that I cant use screen values to move the cursor. If I want to set the cursor from 0 to 1680, I have to use 1680*0.66 as dx value to get the right position (inside game or on desktop).
(I use mousemove, as I am setting the cursor position inside a game, and absolute positioning doesnt work there. I have two screens, one is 1680 wide, the other one has 1280)
Any Idea why I have to use this factor or where it comes from? Thanks.
#define MOUSE_MOVE_FACTOR 0.6619
//Set mouse pos:
void setMousePos(int iX, int iY){
iX = (int)((double)iX*MOUSE_MOVE_FACTOR);
iY = (int)((double)iY*MOUSE_MOVE_FACTOR);
INPUT *buffer = new INPUT[1];
buffer->type = INPUT_MOUSE;
buffer->mi.dx = iX;
buffer->mi.dy = iY;
buffer->mi.mouseData = 0;
buffer->mi.dwFlags = MOUSEEVENTF_MOVE;
buffer->mi.time = 0;
buffer->mi.dwExtraInfo = 0;
SendInput(1,buffer,sizeof(INPUT));
Sleep(100 + (rand() % 50));
}