I’ve created a small AHK script that does click:
Loop {
ControlClick, x%X% y%Y%, ahk_id %hwnd%,, LEFT,, NA
Sleep, %SleepBetween%
} Until not WinExist("ahk_id " hwnd)
When the window is active, and I’m hovering over the screen with my mouse, the elements on the screen are being activated. Irrespective of what is sent in the message.
When checking winspy messages, I see:
WM_LBUTTONDOWN fwKeys:MK_LBUTTON xPos:300 yPos:200
WM_LBUTTONUP fwKeys: 0000 xPos:300 yPos:200
So, that is accurate.
However, when I activate the window, the click happens on the place of the cursor.
And when I deactivate the window (ie: switch to another one), the action is happening, but the click is not. So when you ‘click’, there is a character shooting. This shooting is happening accurately. But sometimes another character moves over the screen horizontally and you need to click it. (The coordinates are accurate to both shoot and hit the moving character.) That is not happening unless I activate and position my cursor accurately.
What I’m struggling to understand is: why is the mouse behaviour not the same with an activated/non activated window? And why would the program not take into account the x/y coordinates passed with the mouse down/up events?