Search code examples
c++mousemove

CPP Win32 Moving the Mouse, Wont move to where I specify


I took the code from here: How to simulate a mouse movement

I got it and it seemed to be working, I didn't fully test it, but I was able to get the mouse to click a tab on firefox. (Having the program load over the FF window.)

I changed the window struct for the window to be smaller, and gave it a specific position instead of letting windows do it: (0,0).

Then I tried plugging in coords for the mouse to move to (830, 380), and tried (630, 390) both resulted in the mouse going directly to the bottom right corner of the screen. Those are coords for an auto clicker I am working on.

I really haven't modified the code too much.

Does anyone have any idea why this is? I'm sure I must be missing something...

Thanks.


Solution

  • Just use the mouse_event http://msdn.microsoft.com/en-us/library/windows/desktop/ms646260%28v=vs.85%29.aspx
    or SendInput http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310%28v=vs.85%29.aspx

    to do the job. I believe the coordinates are normalized to the range of 0-65535 for both X and Y