Dae Posted December 29, 2006 Share Posted December 29, 2006 (edited) Can you use these on hidden windows? PixelSearch and MouseClick. Oh and can you even direct PixelSearch and MouseClick to only apply to a certain window (via handle or name)? Like how ControlSend works.. I need to know because I intend on hiding a game window, and moving around with the mouse and checking for certain pixels. Thanks Edited December 29, 2006 by Dae Link to comment Share on other sites More sharing options...
Outshynd Posted December 29, 2006 Share Posted December 29, 2006 PixelSearch will not work on a window that is not visible. Link to comment Share on other sites More sharing options...
Dae Posted December 29, 2006 Author Share Posted December 29, 2006 PixelSearch will not work on a window that is not visible.Thanks, what about MouseClick. Or any other function to send mouse x/y clicks to a hidden window? Link to comment Share on other sites More sharing options...
Outshynd Posted December 29, 2006 Share Posted December 29, 2006 ControlClick probably works (I don't know, never used it). I wrote a wrapper around PostMessage API for use with a game I used to play, no guarantee any of it will work for you though. expandcollapse popupFunc _MakeLong($LoWord, $HiWord) Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF)) EndFunc Func _MouseClick($hWnd, $button, $x, $y, $times=1, $delay=250) If $hWnd = 0 Then SetError(-1) Return EndIf Local $ix Local $lParam = _MakeLong($x, $y) Local $user32 = DllOpen("user32.dll") $button = StringLower($button) If $button = "left" Then For $ix = 1 To $times DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x200, "int", 0, "long", $lParam) DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x201, "int", 1, "long", $lParam) DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x202, "int", 0, "long", $lParam) If $ix < $times Then Sleep($delay) Next ElseIf $button = "right" Then For $ix = 1 To $times DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x200, "int", 0, "long", $lParam) DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x204, "int", 2, "long", $lParam) DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x205, "int", 0, "long", $lParam) If $ix < $times Then Sleep($delay) Next Else SetError(-2) If $user32 <> -1 Then DllClose($user32) Return EndIf If $user32 <> -1 Then DllClose($user32) EndFunc Link to comment Share on other sites More sharing options...
Dae Posted December 29, 2006 Author Share Posted December 29, 2006 (edited) How would I use ControlClick? For ControlSend I would put the window handle in the "title" parameter, but for ControlClick it says you can use the window handle in the controlID parameter. Do I put the window handle in both? ControlClick ( "title", "text", controlID [, button] [, clicks]] ) I don't see anywhere to specify the x/y coords to click at. Seems like it only sends commands to controls in a window. So theres no x/y. Nice wrapper, Outshynd. But I don't think my game has a .dll I can send commands to the game with. Edited December 29, 2006 by Dae Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 29, 2006 Moderators Share Posted December 29, 2006 (edited) How would I use ControlClick? For ControlSend I would put the window handle in the "title" parameter, but for ControlClick it says you can use the window handle in the controlID parameter. Do I put the window handle in both? ControlClick ( "title", "text", controlID [, button] [, clicks]] ) I don't see anywhere to specify the x/y coords to click at. Nice wrapper, Outshynd. But I don't think my game has a .dll I can send commands to the game with.http://www.autoitscript.com/forum/index.ph...ost&p=37526 Edit: BTW, Outshynd's code is using the User32.dll, do you not have one of those Edited December 29, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Dae Posted December 29, 2006 Author Share Posted December 29, 2006 http://www.autoitscript.com/forum/index.ph...ost&p=37526Edit:BTW, Outshynd's code is using the User32.dll, do you not have one of those Are these dlls in the autoit or windows library then?Well I assumed I needed the dll in my project folder. Because I tried his script with "MSN Messenger" and it doesn't click or do anything. No error or anything. I changed the dll name to Us32.dll to test if it gives an error if the dll doesn't exist, and it didn't, it just does nothing. Link to comment Share on other sites More sharing options...
Dae Posted December 29, 2006 Author Share Posted December 29, 2006 http://www.autoitscript.com/forum/index.ph...ost&p=37526But smoke that is about clicking in controls. I don't have any controls to click in. This is a game that programmed its own UI, and doesn't use the windows API. All I have is a class name, and a handle, and I could get a PID. Link to comment Share on other sites More sharing options...
Dae Posted December 29, 2006 Author Share Posted December 29, 2006 (edited) Oh I see it wants the handle of the control. I don't think I have any control, just the window. ControlSend sends a key as the control. Can't I omit the handle to any control? I don't have any edit box or button to use as a control. I need to use the entire window as the control. I just did some testing with the classnameNN. That might work, I'll check tomorrow. I'd still appreciate any ideas on how to work with it on games like warcraft. Edited December 29, 2006 by Dae Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now