AW: Maus Bot
15.01.2007 07:38:21
Nepumuk
Hallo Andreas,
ich habe die Erfahrung gemacht, dass eine per Programm erzeugte Mausbewegung dafür nicht ausreicht. Darum lasse ich die Maus einen Klick in die Titelleiste des aktiven Fensters machen. Das klappt zu 99%.
Der Code:
Option Explicit
Private Declare Sub Sleep Lib "kernel32.dll" ( _
ByVal dwMilliseconds As Long)
Private Declare Function SetCursorPos Lib "user32.dll" ( _
ByVal x As Long, _
ByVal y As Long) As Long
Private Declare Function GetCursorPos Lib "user32.dll" ( _
ByRef lpPoint As POINTAPI) As Long
Private Declare Sub mouse_event Lib "user32.dll" ( _
ByVal dwFlags As Long, _
ByVal dx As Long, _
ByVal dy As Long, _
ByVal dwdata As Long, _
ByVal dwExtraInfo As Long)
Private Declare Function GetWindowRect Lib "user32.dll" ( _
ByVal hWnd As Long, _
ByRef lpRect As RECT) As Long
Private Declare Function GetActiveWindow Lib "user32.dll" () As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Type RECT
lngLeft As Long
lngTop As Long
lngRight As Long
lngBottom As Long
End Type
Private Const MOUSEEVENT_LEFTDOWN = &H2
Private Const MOUSEEVENT_LEFTUP = &H4
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Load()
Timer1.Interval = 65535
End Sub
Private Sub Timer1_Timer()
Dim udtPositon As POINTAPI, udtRect As RECT
GetCursorPos udtPositon
GetWindowRect GetActiveWindow, udtRect
SetCursorPos udtRect.lngLeft + 30, udtRect.lngTop + 10
mouse_event MOUSEEVENT_LEFTDOWN, 0&, 0&, 0&, 0&
mouse_event MOUSEEVENT_LEFTUP, 0&, 0&, 0&, 0&
SetCursorPos udtPositon.x, udtPositon.y
End Sub
Die Datei: https://www.herber.de/bbs/user/39673.zip
Gruß
Nepumuk