ControlClick, _MouseClickPlus without ID

02/11/2015 17:41 Gedix#1
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
Code:
ControlClick("WindowName","","","right/left",x,y,times)
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:
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
simply doesn't work, even specifing
Code:
AutoItSetOption("MouseCoordmode", 0)
at the biginning. I thought that the fact I'm using a 64 bit system might be a problem but even with
Code:
#AutoIt3Wrapper_UseX64
Strange fact: I've already made background bot in the same game using
Code:
ControlSend ( "Name", "", "", "commands")
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...
02/11/2015 18:05 alpines#2
How about using #RequireAdmin.
02/11/2015 18:12 Gedix#3
Quote:
Originally Posted by alpines View Post
How about using #RequireAdmin.
Well I use it in every bot i made, since without it almost no action with the game would work xD
02/11/2015 18:28 alpines#4
Maybe the game is blocking such inputs. Which game do you want to access by these commands?
02/11/2015 18:39 Gedix#5
Quote:
Originally Posted by alpines View Post
Maybe the game is blocking such inputs. Which game do you want to access by these commands?
Metin2, mmorpg online.
02/11/2015 22:43 alpines#6
If you're playing on the official servers with active HackShield then you need a bypass do send inputs to the window.
02/11/2015 23:18 Gedix#7
Quote:
Originally Posted by alpines View Post
If you're playing on the official servers with active HackShield then you need a bypass do send inputs to the window.
I'm not playing on the official server...the thing I do not understand is why controlSend should work and controlClick not. I mean, both functions send input to the window right?
02/12/2015 13:50 Clonko#8
I got a similar probleme last days.. Solved it for me since I specified a controlID

Code:
ControlClick(WindowName, "", "[CLASS:XXXX; INSTANCE:XXXX]", "left", 1, x, y)
02/12/2015 14:19 Gedix#9
Quote:
Originally Posted by Clonko View Post
I got a similar probleme last days.. Solved it for me since I specified a controlID

Code:
ControlClick(WindowName, "", "[CLASS:XXXX; INSTANCE:XXXX]", "left", 1, x, y)
Yes but, as i specified in the title, I have no controlID of the game (searched with Autoit Window Info and similar programs) nor other information except for the title and class. Specifing class as the third parameter doesn't work either. So what kind of parameter should i put there?
02/12/2015 18:19 alpines#10
The DirectX Control has no ID that could be used to identify it.
02/12/2015 21:54 Gedix#11
Quote:
Originally Posted by alpines View Post
The DirectX Control has no ID that could be used to identify it.
Ok, so no ID can be found. Yet I don't understand why does controlSend work, while controlClick does not!