Jump to content

Recommended Posts

Posted (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 by Dae
Posted

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?

Posted

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.

Func _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
Posted (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 by Dae
  • Moderators
Posted (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 :P

Edited 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.

Posted

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 :P

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.

Posted (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 by Dae

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...