vb模拟鼠标点击
要求:单击一个按钮鼠标自动点击坐标x125,y159的地方单机完后延时3秒后再点击x165,y254的地方然后停止。给我代码如果行在给50分...
要求:单击一个按钮 鼠标自动点击坐标x125,y159的地方单机完后延时3秒后再点击x165,y254的地方然后停止。
给我代码如果行在给50分 展开
给我代码如果行在给50分 展开
2个回答
展开全部
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()
AutoPressMouse 125, 159
Sleep 3000
AutoPressMouse 165, 254
End Sub
Private Sub AutoPressMouse(x As Long, y As Long)
SetCursorPos x, y
' mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event 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)
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
AutoPressMouse 125, 159
Sleep 3000
AutoPressMouse 165, 254
End Sub
Private Sub AutoPressMouse(x As Long, y As Long)
SetCursorPos x, y
' mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询