2个回答
2009-03-20
展开全部
private Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Private Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
Private Sub form_load()
timer1.interval=5000
end sub
Private Sub Timer1_Timer()
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 '鼠标左键按下
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 '鼠标左键松开
End Sub
Private Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
Private Sub form_load()
timer1.interval=5000
end sub
Private Sub Timer1_Timer()
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 '鼠标左键按下
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 '鼠标左键松开
End Sub
展开全部
在窗体上画一个timer控件,用如下测试你的要求:每5秒中模拟单击鼠标左键。
Private Sub Form_Load()
Timer1.Interval = 5000
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Print "单击左键"
ElseIf Button = 2 Then
Print "单击右键"
End If
End Sub
Private Sub Timer1_Timer()
Call Form_MouseDown(1, 0, 5000, 5000)
End Sub
Private Sub Form_Load()
Timer1.Interval = 5000
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Print "单击左键"
ElseIf Button = 2 Then
Print "单击右键"
End If
End Sub
Private Sub Timer1_Timer()
Call Form_MouseDown(1, 0, 5000, 5000)
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询