vb按键判断及模拟点击问题 10
vb按键判断及模拟点击问题判断,如果右键被单击,那么,单击左键,间隔一秒,单击右键,间隔一秒,再次单击右键,该怎么写...
vb按键判断及模拟点击问题
判断,如果右键被单击,那么,单击左键,间隔一秒,单击右键,间隔一秒,再次单击右键,该怎么写 展开
判断,如果右键被单击,那么,单击左键,间隔一秒,单击右键,间隔一秒,再次单击右键,该怎么写 展开
展开全部
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds 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)
Const MOUSEEVENTF_LEFTDOWN = &H2
Const KEYEVENTF_KEYUP = &H2
Const MOUSEEVENTF_LEFTUP = &H4
Const MOUSEEVENTF_MIDDLEDOWN = &H20
Const MOUSEEVENTF_MIDDLEUP = &H40
Const MOUSEEVENTF_MOVE = &H1
Const MOUSEEVENTF_ABSOLUTE = &H8000
Const MOUSEEVENTF_RIGHTDOWN = &H8
Const MOUSEEVENTF_RIGHTUP = &H10
'延时函数做岩 sleep
Private Function Delay(DT As Long)
For i = 0 To DT Step 2
DoEvents '操作权铅埋交给系统 否则纯激御程序会暂时无响应
Sleep 1
Next i
End Function
Private Sub Command1_Click()
call 左键
delay 1000
call 右键
delay 1000
call 右键
End Sub
Private Sub 左键()
Delay 40
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
Delay 40
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Delay 40
End Sub
Private Sub 右键()
Delay 30
mouse_event MOUSEEVENTF_RIGHTDOWN Or MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
Delay 40
mouse_event MOUSEEVENTF_RIGHTDOWN Or MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
Delay 30
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 KEYEVENTF_KEYUP = &H2
Const MOUSEEVENTF_LEFTUP = &H4
Const MOUSEEVENTF_MIDDLEDOWN = &H20
Const MOUSEEVENTF_MIDDLEUP = &H40
Const MOUSEEVENTF_MOVE = &H1
Const MOUSEEVENTF_ABSOLUTE = &H8000
Const MOUSEEVENTF_RIGHTDOWN = &H8
Const MOUSEEVENTF_RIGHTUP = &H10
'延时函数做岩 sleep
Private Function Delay(DT As Long)
For i = 0 To DT Step 2
DoEvents '操作权铅埋交给系统 否则纯激御程序会暂时无响应
Sleep 1
Next i
End Function
Private Sub Command1_Click()
call 左键
delay 1000
call 右键
delay 1000
call 右键
End Sub
Private Sub 左键()
Delay 40
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
Delay 40
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Delay 40
End Sub
Private Sub 右键()
Delay 30
mouse_event MOUSEEVENTF_RIGHTDOWN Or MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
Delay 40
mouse_event MOUSEEVENTF_RIGHTDOWN Or MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
Delay 30
End Sub
展开全部
如果是模拟的vb本身如纳,按照所需时间调用控件的 mousedown 事件处理程序即升樱可。
模渣笑没拟对别的软件的点击好像比较复杂。。
模渣笑没拟对别的软件的点击好像比较复杂。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
如果只是对你制作的程序进行模拟的话,只需要两个Timer控件就可以了森饥(一个控制左键一个肆毁控制右键)然后用MouseDown编辑你所想要的事件,例如:MouseDown事件触发后,Image1.Picture = Load Picture ("你的图像路径")
你可以说清楚你想要执行什裂春备么事件
你可以说清楚你想要执行什裂春备么事件
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询