VB Programmers... Hopefully *M* - Help Needed

03/06/2008 11:37 Stink.Fly#1
Ok, ive been taking apart *M*s source code for his multi hack... trying to figure out how it works etc, but as of yet, still cannot find out how to send mouse events PURELY to a hooked client... This is the entire code for the main form. (ive edited out loads of code which didnt relate to the clicker function.

Code:
[SIZE=1]Dim Handle As Long[/SIZE]
[SIZE=1]Dim ProcessID As Long[/SIZE]
[SIZE=1]Dim ProcessHandle As Long[/SIZE]
[SIZE=1]Dim POINT_API As POINTAPI[/SIZE]
[SIZE=1]Dim X As Long, Y As Long, Z As Long, A As Long[/SIZE]
[SIZE=1]Private Const PROCESS_ALL_ACCESS = &H1F0FFF[/SIZE]
[SIZE=1]Option Explicit[/SIZE]
 
[SIZE=1]Private Sub LeftClick()[/SIZE]
[SIZE=1][COLOR=black]'   mouse_event LEFT_DOWN, 0&, 0&, X, Y[/COLOR][/SIZE]
[SIZE=1][COLOR=black]'   mouse_event LEFT_UP, 0&, 0&, X, Y[/COLOR][/SIZE]
[SIZE=1][COLOR=blue]   mouse_event RIGHT_DOWN, 0&, 0&, X, Y - For testing ive only enabled these clicks.[/COLOR][/SIZE]
[SIZE=1][COLOR=blue]   mouse_event RIGHT_UP, 0&, 0&, X, Y[/COLOR][/SIZE]
[SIZE=1]End Sub[/SIZE]
 
[SIZE=1]Private Function GetMousePosX() As Long[/SIZE]
[SIZE=1]   Z = GetCursorPos(POINT_API)[/SIZE]
[SIZE=1]   GetMousePosX = POINT_API.X[/SIZE]
[SIZE=1]End Function[/SIZE]
 
[SIZE=1]Private Function GetMousePosY() As Long[/SIZE]
[SIZE=1]   Z = GetCursorPos(POINT_API)[/SIZE]
[SIZE=1]   GetMousePosY = POINT_API.Y[/SIZE]
[SIZE=1]End Function[/SIZE]
 
[SIZE=1]Private Function GetKeyState(Key As Integer) As Boolean[/SIZE]
[SIZE=1]   GetKeyState = CBool(GetAsyncKeyState(Key))[/SIZE]
[SIZE=1]End Function[/SIZE]
 
[SIZE=1]Private Sub StartClick()[/SIZE]
[SIZE=1]   If Clicker.Enabled = False Then[/SIZE]
[SIZE=1]       Clicker.Interval = CInt(Val(Text8.Text))[/SIZE]
[SIZE=1]       Clicker.Enabled = True[/SIZE]
 
[SIZE=1]       Label13.Caption = " Status: Clicking..."[/SIZE]
[SIZE=1]   End If[/SIZE]
[SIZE=1]End Sub[/SIZE]
 
[SIZE=1]Private Sub StopClick()[/SIZE]
[SIZE=1]   If Clicker.Enabled = True Then[/SIZE]
[SIZE=1]       Clicker.Enabled = False[/SIZE]
 
[SIZE=1]       Label13.Caption = " Status: Clicking Stopped!"[/SIZE]
[SIZE=1]   End If[/SIZE]
[SIZE=1]End Sub[/SIZE]
 
[SIZE=1]Private Sub ClickCounter_Timer()[/SIZE]
[SIZE=1]   If A = 0 Then[/SIZE]
[SIZE=1]       ClickCounter.Enabled = False[/SIZE]
[SIZE=1]       Command24.Caption = "Click"[/SIZE]
[SIZE=1]       Label3.Caption = "0 Clicks Per Sec"[/SIZE]
[SIZE=1]   Else[/SIZE]
[SIZE=1]       Label3.Caption = CStr(A * 0.25) & " Clicks Per Sec"[/SIZE]
[SIZE=1]       A = 0[/SIZE]
[SIZE=1]   End If[/SIZE]
[SIZE=1]End Sub[/SIZE]
 
[SIZE=1]Private Sub Clicker_Timer()[/SIZE]
[SIZE=1]   Call LeftClick[/SIZE]
[SIZE=1]   DoEvents[/SIZE]
[SIZE=1]End Sub[/SIZE]
 
[SIZE=1]Private Sub Command22_Click()[/SIZE]
[SIZE=1]   Call StartClick[/SIZE]
[SIZE=1]End Sub[/SIZE]
 
[SIZE=1]Private Sub Command23_Click()[/SIZE]
[SIZE=1]   Call StopClick[/SIZE]
[SIZE=1]End Sub[/SIZE]
 
[SIZE=1]Private Sub Command24_Click()[/SIZE]
[SIZE=1]   If ClickCounter.Enabled = False Then ClickCounter.Enabled = True[/SIZE]
[SIZE=1]   If Label3.Caption <> "Counting..." Then Label3.Caption = "Testing..."[/SIZE]
 
[SIZE=1]   A = A + 1[/SIZE]
[SIZE=1]   Command24.Caption = CStr(A)[/SIZE]
[SIZE=1]End Sub[/SIZE]
 
[SIZE=1]Private Sub Hotkey_XY_Timer()[/SIZE]
[SIZE=1]   If GetKeyState(vbKeyF9) = True Then Call StartClick[/SIZE]
[SIZE=1]   If GetKeyState(vbKeyF10) = True Then Call StopClick[/SIZE]
 
[SIZE=1]   Label14.Caption = "X: " & CStr(GetMousePosX)[/SIZE]
[SIZE=1]   Label16.Caption = "Y: " & CStr(GetMousePosY)[/SIZE]
 
[SIZE=1]   DoEvents[/SIZE]
[SIZE=1]End Sub[/SIZE]
 
[SIZE=1]Private Sub Timer1_Timer() 'Window Hooking[/SIZE]
[SIZE=1]   Handle = FindWindow(vbNullString, "[Conquer2.0]")[/SIZE]
[SIZE=1]   GetWindowThreadProcessId Handle, ProcessID[/SIZE]
[SIZE=1]   ProcessHandle = OpenProcess(PROCESS_ALL_ACCESS, False, ProcessID)[/SIZE]
[SIZE=1]   If Handle > 0 Then[/SIZE]
[SIZE=1]   WinHook.Text = "Hooked"[/SIZE]
[SIZE=1]   Else[/SIZE]
[SIZE=1]   WinHook.Text = "Waiting..."[/SIZE]
[SIZE=1]   End If[/SIZE]
[SIZE=1]End Sub[/SIZE]
 
[SIZE=1]Private Sub Form_Load()[/SIZE]
[SIZE=1]frm_MultiHack.Show[/SIZE]
[SIZE=1]frm_MultiHack.Visible = True[/SIZE]
[SIZE=1]Call Timer3_Timer[/SIZE]
[SIZE=1]Timer4.Enabled = False[/SIZE]
[SIZE=1]End Sub[/SIZE]
 
[SIZE=1]Private Sub Form_Unload(Cancel As Integer)[/SIZE]
[SIZE=1]Call Option1_Click 'Turn Speed off on close[/SIZE]
[SIZE=1]Timer4.Enabled = False[/SIZE]
[SIZE=1]Timer5.Enabled = False[/SIZE]
[SIZE=1]End Sub[/SIZE]
 
[SIZE=1]Private Sub Timer4_Timer()[/SIZE]
[SIZE=1]Timer4.Enabled = True[/SIZE]
[SIZE=1]SendKeys "{F10}"[/SIZE]
[SIZE=1]End Sub[/SIZE]
 
[SIZE=1]Private Sub Timer5_Timer() '//Spam F10/XP Skill[/SIZE]
[SIZE=1]Timer5.Enabled = False[/SIZE]
[SIZE=1]Call Timer4_Timer[/SIZE]
[SIZE=1]End Sub[/SIZE]
So if someone could possibly give me the syntax for sending clicks to a specific window handle plzz letme know...

I heard something about SendMessage (hWnd, event, reply) :confused:

And question for *M*.. is this where you got the click code from?[Only registered and activated users can see links. Click Here To Register...]
03/06/2008 15:06 phize#2
God will you people stop saying "hooked", just because you open the process handle its NOT hooked. A hook is a function working in between or before original function allowing you to manipulate/intercept parameters passed on to it, etc.
And yes as I said SendMessage works.. :)
03/06/2008 15:46 mr.anzi#3
This is what i use in my autoclicker, look [Only registered and activated users can see links. Click Here To Register...].

well here comes the part when sending mouse clicks..
That function there i took somewhere when i was searching info about this.

Code:
SendMessage Handlex, WM_RBUTTONDOWN, 1&, MakeLong(15, 20)
SendMessage Handlex, WM_RBUTTONUP, 1&, MakeLong(15, 20)

Function MakeLong(ByVal LoWord As Integer, ByVal HiWord As Integer) As Long
MakeLong = (HiWord * &H10000) Or (LoWord And &HFFFF&)
End Function
Handlex is handle of child window of CO.
Makelong(coordX,coordY)

and WM_RBUTTONDOWN = &H204
03/06/2008 16:31 Stink.Fly#4
Quote:
Originally Posted by RootCore View Post
God will you people stop saying "hooked", just because you open the process handle its NOT hooked. A hook is a function working in between or before original function allowing you to manipulate/intercept parameters passed on to it, etc.
And yes as I said SendMessage works.. :)
-.- hello? new to vb... how was I supposed to know that? :mad: Makes sense though so thanks.

Quote:
Originally Posted by mr.anzi View Post
This is what i use in my autoclicker, look [Only registered and activated users can see links. Click Here To Register...].

well here comes the part when sending mouse clicks..
That function there i took somewhere when i was searching info about this.

Code:
SendMessage Handlex, WM_RBUTTONDOWN, 1&, MakeLong(15, 20)
SendMessage Handlex, WM_RBUTTONUP, 1&, MakeLong(15, 20)
 
Function MakeLong(ByVal LoWord As Integer, ByVal HiWord As Integer) As Long
MakeLong = (HiWord * &H10000) Or (LoWord And &HFFFF&)
End Function
Handlex is handle of child window of CO.
Makelong(coordX,coordY)

and WM_RBUTTONDOWN = &H204
w00t, ill give it a go. Thanks ;)
03/06/2008 18:10 Stink.Fly#5
kk... now it seems i need to get the child window of a client... WTF? How can it have a child window if its all contained inside the main window? My idea of chld would be a form/window generated from withtin the parent window... correct or not?
03/06/2008 19:22 phize#6
That is correct, and the whole user interface of CO is made of child windows.
03/07/2008 10:46 Stink.Fly#7
Quote:
Originally Posted by RootCore View Post
That is correct, and the whole user interface of CO is made of child windows.
mkay, and to retrieve these child handles? :confused: