vb编写一个鼠标控制程序
这是我以前做的一个鼠标连点器,把源码给你吧
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Const MOUSEEVENTF_LEFTDOWN = &H2
Const MOUSEEVENTF_LEFTUP = &H4
Const MOUSEEVENTF_RIGHTDOWN = &H8
Const MOUSEEVENTF_RIGHTUP = &H10
Private Sub Command3_Click()
End
End Sub
Private Sub HScroll1_Change()
Text1.Text = HScroll1.Value
Timer1.Interval = HScroll1.Value
End Sub
Private Sub Timer1_Timer()
If Option1.Value = True Then mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
If Option2.Value = True Then mouse_event MOUSEEVENTF_RIGHTDOWN Or MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
If Option3.Value = True Then
mouse_event MOUSEEVENTF_RIGHTDOWN Or MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End If
End Sub
Private Sub Timer2_Timer()
If GetAsyncKeyState(vbKeyF1) Then Timer1.Enabled = True
If GetAsyncKeyState(vbKeyF2) Then
Timer1.Enabled = False
MsgBox "已停止连点!", vbInformation, "小翟提示"
End If
End Sub
2023-05-10 广告