Jump to content

How can I inject/target a program?


Recommended Posts

For Send to work, the target window AND control need to be in "focus" - the currently active window and control. You'd need to WinActivate the window with the control you need to send to, then ControlClick the control you want to send to.

I find ControlClick to be a lot quicker, easier, and more reliable. If you device the Title and Text of the control's window specifically enough to avoid selecting the wrong window and/or control, it's all that's needed.

Link to comment
Share on other sites

I've seen programs that "inject" or send keys to a program without having it in focus.

Here is a bot made for World of Warcraft which supposedly injects but I cant make any sense out of it...

; ---------------------------------------------------------------------------- 
; 
; AutoIt Version:        3.2.0 
; Author:                The-Chad <chadscrib@gmail.com> 
; Website:              OnlineGameHacker <www.OnlineGameHacker.com> 
; Script Function:      Anti Afk 
; 
; ---------------------------------------------------------------------------- 


HotKeySet("{F9}", "hide") 
HotKeySet("{F10}", "show") 
AutoItSetOption("WinTitleMatchMode", 4) 
While 1 
   Sleep(1000) 
WEnd 

Func hide() 
   Global $Show = 0 
   Global $handle = WinGetHandle("classname=GxWindowClassD3d") 
   WinSetState($handle, "", @SW_MINIMIZE) 
   WinSetState($handle, "", @SW_HIDE) 
   If @error Then 
      MsgBox(0, "error", "couldnt find WoW") 
   Else 
      While 1 
         $unique = Random(1, 4, 1) 
         If $unique = 1 Then 
            ControlSend($handle, "", "", "{UP DOWN}") 
            Sleep(100 + Random(1, 50, 1)) 
            ControlSend($handle, "", "", "{UP UP}") 
            ControlSend($handle, "", "", "{DOWN DOWN}") 
            Sleep(100 + Random(1, 50, 1)) 
            ControlSend($handle, "", "", "{DOWN UP}") 
            Sleep(200000 + Random(5000, 15000, 1)) 
         ElseIf $unique = 2 Then 
            ControlSend($handle, "", "", "{RIGHT DOWN}") 
            Sleep(100 + Random(1, 50, 1)) 
            ControlSend($handle, "", "", "{RIGHT UP}") 
            ControlSend($handle, "", "", "{LEFT DOWN}") 
            Sleep(100 + Random(1, 50, 1)) 
            ControlSend($handle, "", "", "{LEFT UP}") 
            Sleep(200000 + Random(5000, 15000, 1)) 
         ElseIf $unique = 3 Then 
            ControlSend($handle, "", "", "{DOWN DOWN}") 
            Sleep(100 + Random(1, 50, 1)) 
            ControlSend($handle, "", "", "{DOWN UP}") 
            ControlSend($handle, "", "", "{UP DOWN}") 
            Sleep(100 + Random(1, 50, 1)) 
            ControlSend($handle, "", "", "{UP UP}") 
            Sleep(200000 + Random(5000, 15000, 1)) 
         ElseIf $unique = 4 Then 
            ControlSend($handle, "", "", "{LEFT DOWN}") 
            Sleep(100 + Random(1, 50, 1)) 
            ControlSend($handle, "", "", "{LEFT UP}") 
            ControlSend($handle, "", "", "{RIGHT DOWN}") 
            Sleep(100 + Random(1, 50, 1)) 
            ControlSend($handle, "", "", "{RIGHT UP}") 
            Sleep(200000 + Random(5000, 15000, 1)) 
         EndIf 
         If $Show > 0 Then ExitLoop 
      WEnd 
   EndIf 
EndFunc  ;==>hide 

Func show() 
   Global $Show = 1 
   WinSetState("World of Warcraft", "", @SW_SHOW) 
   WinSetState("World of Warcraft", "", @SW_MAXIMIZE) 
   WinActivate($handle, "") 
EndFunc  ;==>show
Link to comment
Share on other sites

but I cant make any sense out of it...

Then perhaps start reading the helpfile.

There's nothing tricky in that code, just basic AutoIt commands. If you haven't bothered to read about each of them, of course you have trouble understanding what exactly they do. Although to be honest the syntax and function names are pretty self-explanatory.

Edited by Siao

"be smart, drink your wine"

Link to comment
Share on other sites

Siao,

When I say I can't make sense of it I don't mean I'm completely clueless. I do understand what that code is doing but I don't know exactly what pieces I require to simple send a key to the app.

I'm familiar with SW_HIDE and SW_MINIMIZE functions because I've used them in C# programming before although in C# you have to import user32.dll to perform these functions.

If anyone can help it would be much appreciated!

Regards

- muzle6074

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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