Option Explicit
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dX As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Const LEFT_DOWN = &H2
Private Const LEFT_UP = &H4
Private Type POINTAPI
X As Long
Y As Long
End Type
Dim POINT_API As POINTAPI
Dim X As Long, Y As Long, Z As Long, A As Long
Private Sub LeftClick()
mouse_event LEFT_DOWN, 0&, 0&, X, Y
mouse_event LEFT_UP, 0&, 0&, X, Y
End Sub
Private Function GetMousePosX() As Long
Z = GetCursorPos(POINT_API)
GetMousePosX = POINT_API.X
End Function
Private Function GetMousePosY() As Long
Z = GetCursorPos(POINT_API)
GetMousePosY = POINT_API.Y
End Function
Private Function GetKeyState(Key As Integer) As Boolean
GetKeyState = CBool(GetAsyncKeyState(Key))
End Function
Private Sub StartClick()
If Clicker.Enabled = False Then
Clicker.Interval = CInt(Val(Text1.Text))
Clicker.Enabled = True
Label2.Caption = " Status: Clicking..."
End If
End Sub
Private Sub StopClick()
If Clicker.Enabled = True Then
Clicker.Enabled = False
Label2.Caption = " Status: Clicking Stopped!"
End If
End Sub
Private Sub Clicker_Timer()
Call LeftClick
DoEvents
End Sub
Private Sub Command1_Click()
Call StartClick
End Sub
Private Sub Command2_Click()
Call StopClick
End Sub
Private Sub Hotkey_XY_Timer()
If GetKeyState(vbKeyF9) = True Then Call StartClick
If GetKeyState(vbKeyF10) = True Then Call StopClick
Label4.Caption = "X: " & CStr(GetMousePosX)
Label5.Caption = "Y: " & CStr(GetMousePosY)
DoEvents
End Sub
Private Sub ClickCounter_Timer()
If A = 0 Then
ClickCounter.Enabled = False
Command3.Caption = "Click"
Label3.Caption = "0 Clicks Per Sec"
Else
Label3.Caption = CStr(A * 0.25) & " Clicks Per Sec"
A = 0
End If
End Sub
Private Sub Command3_Click()
If ClickCounter.Enabled = False Then ClickCounter.Enabled = True
If Label3.Caption <> "Counting..." Then Label3.Caption = "Counting..."
A = A + 1
Command3.Caption = CStr(A)
End Sub
Private Sub Form_Load()
If App.PrevInstance = True Then
MsgBox "Application running.", vbExclamation, "Application"
Unload Me
End
End If
End Sub
Private Sub Form_Unload(cancel As Integer)
Unload Me
End
End Sub