VB里面怎么做一个间隔一秒按下鼠标左键的EXE文件啊
展开全部
'form里加2个按钮,一个timer
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)
Const MOUSEEVENTF_LEFTDOWN = &H2
Const MOUSEEVENTF_LEFTUP = &H4
Private Sub Command1_Click()
Timer1.Enabled = True
Command2.Enabled = True
Command1.Enabled = False
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
Command1.Enabled = True
Command2.Enabled = False
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 1000 '这里改想点多快
Command1.Enabled = True
Command1.Caption = "Start"
Command2.Enabled = False
Command2.Caption = "Stop"
End Sub
Private Sub Timer1_Timer()
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub
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)
Const MOUSEEVENTF_LEFTDOWN = &H2
Const MOUSEEVENTF_LEFTUP = &H4
Private Sub Command1_Click()
Timer1.Enabled = True
Command2.Enabled = True
Command1.Enabled = False
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
Command1.Enabled = True
Command2.Enabled = False
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 1000 '这里改想点多快
Command1.Enabled = True
Command1.Caption = "Start"
Command2.Enabled = False
Command2.Caption = "Stop"
End Sub
Private Sub Timer1_Timer()
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询