I want to make my program click specific mouse coordinates, so I am using
mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTDOWN, point.x, point.y, 0, 0);
where point.x and point.y are normalized between 0 and 65535. However, it always clicks where the cursor is instead of the coordinates that I pass. Why is that happening?
You might be missing MOUSEEVENTF_MOVE
flag.
If that doesn't work - I suggest you just use SetCursorPos()
to set the location. Then your mouse_move
event should work just fine.
simulate all the mouse events
mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, point.x, point.y, 0, 0);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With