vb模拟鼠标在固定的位置上单击,可为什么看不见效果
mouse_eventMOUSEEVENTF_LEFTDOWNOrMOUSEEVENTF_LEFTUP,0,0,0,0在时间控件里的这段代码看不到效果请各位帮我解释下谢谢...
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
在时间控件里的这段代码看不到效果 请各位帮我解释下 谢谢了
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 Sub Command1_Click()
Call SetCursorPos(321, 43)
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Print 1
End Sub 展开
在时间控件里的这段代码看不到效果 请各位帮我解释下 谢谢了
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 Sub Command1_Click()
Call SetCursorPos(321, 43)
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Print 1
End Sub 展开
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 Const MOUSEEVENTF_LEFTDOWN = &H2 '//加上这两句就可以
Private Const MOUSEEVENTF_LEFTUP = &H4 '//加上这两句就可以
Private Sub Command1_Click()
Call SetCursorPos(321, 43)
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Print 1
End Sub
这个只是在当前鼠标点击。而不是移动。如果需要移动的话。需要移动到指定的位置。
回复
'//看。这样的话。我已经回复你了。就是常量未定义
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 Const MOUSEEVENTF_LEFTDOWN = &H2 '//加上这两句就可以
Private Const MOUSEEVENTF_LEFTUP = &H4 '//加上这两句就可以
Private Sub Command1_Click()
Call SetCursorPos(321, 43)
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Print 1
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询