VB鼠标移动与单击代码

我想让VB实现在某坐标双击一下,延迟几秒,再到另一坐标双击一下,延迟几秒,如此无限循环,这个程序错在哪里了?求指教,谢谢!PrivateDeclareFunctionSe... 我想让VB实现在某坐标双击一下,延迟几秒,再到另一坐标双击一下,延迟几秒,如此无限循环,这个程序错在哪里了?求指教,谢谢!
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) 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 Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
Do
Sleep 5000
AutoPressMouse 676, 455
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Sleep 120000
AutoPressMouse 867, 455
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Sleep 120000
Loop
End Sub
Private Sub AutoPressMouse(x As Long, y As Long)
SetCursorPos x, y
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub
Private Sub Command2_Click()
Form2.Show
End Sub
展开
 我来答
百度网友85f366cb43
2014-03-16 · TA获得超过781个赞
知道小有建树答主
回答量:920
采纳率:61%
帮助的人:456万
展开全部
你把时间循环那部分用个时间控件来进行控制.
每几秒循环一次.

timer.interval = 5000 '5秒一次循环

Private Sub Timer1_Timer()
'这里放循环要做的代码
End Sub
按键来控制时间控件的开始和停止就好
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式