|
原来写过一个开心网的作弊软件,不过是用vb写的,现修改了一下可用。
如果坐标位置不变,你可以直接把这些值写到textbox中,用不了获取这个功能。
F12为退出自动点击按钮,可以按住不放,看看源代码就可以。
由于vba没有timer控件,我直接用do loop代替,可能效率差点,但我想不会影响使用。
Option Explicit
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
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 GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
Private Type POINTAPI
X As Long
Y As Long
End Type
Const MOUSEEVENTF_LEFTDOWN = &H2
Const MOUSEEVENTF_LEFTUP = &H4
Private Sub CommandButton1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If CommandButton1.Caption = "获取按钮坐标" Then
CommandButton1.Caption = "停止获取"
CommandButton2.Enabled = False
GetCommandButtonXY
Else
CommandButton1.Caption = "获取按钮坐标"
CommandButton2.Enabled = True
End If
End Sub
Function GetCommandButtonXY()
Dim Point As POINTAPI
Do
GetCursorPos Point
Label1 = "x:" & Point.X
Label2 = "y:" & Point.Y
DoEvents
If CommandButton1.Caption = "获取按钮坐标" Then Exit Do
Loop
End Function
Private Sub CommandButton2_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
CommandButton1.Enabled = False
CommandButton2.Enabled = False
AutoButtonClick
End Sub
Function AutoButtonClick()
Dim t As Date
Do
t = Timer
Do
If Timer - t >= Val(ComboBox1.Text) / 2 Then Exit Do
DoEvents
If F12Click = True Then Exit Function
Loop
If CheckBox1.Value = True Then
Call SetCursorPos(Val(TextBox1), Val(TextBox2))
Call mouse_event(MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
End If
t = Timer
Do
If Timer - t >= Val(ComboBox1.Text) / 2 Then Exit Do
DoEvents
If F12Click = True Then Exit Function
Loop
If CheckBox2.Value = True Then
Call SetCursorPos(Val(TextBox3), Val(TextBox4))
Call mouse_event(MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
End If
Loop
End Function
Function F12Click() As Boolean
If GetAsyncKeyState(vbKeyF12) = -32768 Then 'F2退出
CommandButton1.Enabled = True
CommandButton2.Enabled = True
F12Click = True
End If
End Function
Private Sub UserForm_Activate()
ComboBox1.List = Split("0.2,0.4,0.6,0.8,1,1.2,1.4,1.6,1.8,2,10", ",")
ComboBox1.ListIndex = 4
CheckBox1.Value = True
End Sub
[ 本帖最后由 pt98 于 2010-3-21 15:56 编辑 ] |
|