I've been troubled with this for a long time...I just ended up using common mouseclick but now i really need to click on a window (game) in BACKGROUND.
So
doesn't work exactly right, that is it actually click on the named window but only where the mouse is positioned, not in x,y.
And _MouseClickPlus:
simply doesn't work, even specifing
at the biginning. I thought that the fact I'm using a 64 bit system might be a problem but even with
Strange fact: I've already made background bot in the same game using
Does anyone ever had the same problem (and solved it) or has suggestion to solve this? Of course I've searched for similar topic in this forum but I've never found a proper solution...
So
Code:
ControlClick("WindowName","","","right/left",x,y,times)
And _MouseClickPlus:
Code:
Func _MouseClickPlus($handle, $Button = "left", $X = "", $Y = "", $Clicks = 1)
Local $MK_LBUTTON = 0x0001
Local $WM_LBUTTONDOWN = 0x0201
Local $WM_LBUTTONUP = 0x0202
Local $MK_RBUTTON = 0x0002
Local $WM_RBUTTONDOWN = 0x0204
Local $WM_RBUTTONUP = 0x0205
Local $WM_MOUSEMOVE = 0x0200
Local $i = 0
Local $user32 = DllOpen("user32.dll")
Select
Case $Button = "left"
$Button = $MK_LBUTTON
$ButtonDown = $WM_LBUTTONDOWN
$ButtonUp = $WM_LBUTTONUP
Case $Button = "right"
$Button = $MK_RBUTTON
$ButtonDown = $WM_RBUTTONDOWN
$ButtonUp = $WM_RBUTTONUP
EndSelect
If $X = "" OR $Y = "" Then
$MouseCoord = MouseGetPos()
$X = $MouseCoord[0]
$Y = $MouseCoord[1]
EndIf
For $i = 1 to $Clicks
DllCall($user32, "int", "SendMessage", "hwnd",$handle, "int", $WM_MOUSEMOVE, "int", 0, "long", _MakeLong($X, $Y))
DllCall($user32, "int", "SendMessage", "hwnd", $handle, "int", $ButtonDown, "int", $Button, "long", _MakeLong($X, $Y))
DllCall($user32, "int", "SendMessage", "hwnd", $handle, "int", $ButtonUp, "int", $Button, "long", _MakeLong($X, $Y))
Next
EndFunc
Func _MakeLong($LoWord,$HiWord)
Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc
Code:
AutoItSetOption("MouseCoordmode", 0)
Code:
#AutoIt3Wrapper_UseX64
Code:
ControlSend ( "Name", "", "", "commands")