vb mouse_event函数提交鼠标事件问题
本程序要实现:激活一个网页窗口后,鼠标移动适当位置再实现鼠标点击。现在无法实现鼠标点击,感觉mouse_event使用有问题,代码如下:PublicTypePOINTAP...
本程序要实现:激活一个网页窗口后,鼠标移动适当位置再实现鼠标点击。现在无法实现鼠标点击,感觉mouse_event使用有问题,代码如下:
Public Type POINTAPI
X As Long
Y As Long
End Type
Public Const MOUSEEVENTF_LEFTDOWN = &H4
Public Const MOUSEEVENTF_LEFTUP = &H2
Private Declare Sub mouse_event Lib "user32" (ByValdwFlags As Long, ByVal dx As Long, ByValdy As Long, ByValcButtons As Long, ByValdwExtraInfo As Long)
Public Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Sub Timer1_Timer()
ShowWindow 53413012, SW_SHOWMAXIMIZED
mousestep.X = mousestep.X + 15
mousestep.Y = mousestep.Y + 10
SetCursorPos mousestep.X, mousestep.Y
If mousestep.X > moulast.X And mousestep.Y > moulast.Y Then
Timer1.Enabled = False
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End If
End Sub
鼠标移动,句柄均无问题,但在激活的窗口中就是无法实现鼠标点击事件,求大神指点 展开
Public Type POINTAPI
X As Long
Y As Long
End Type
Public Const MOUSEEVENTF_LEFTDOWN = &H4
Public Const MOUSEEVENTF_LEFTUP = &H2
Private Declare Sub mouse_event Lib "user32" (ByValdwFlags As Long, ByVal dx As Long, ByValdy As Long, ByValcButtons As Long, ByValdwExtraInfo As Long)
Public Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Sub Timer1_Timer()
ShowWindow 53413012, SW_SHOWMAXIMIZED
mousestep.X = mousestep.X + 15
mousestep.Y = mousestep.Y + 10
SetCursorPos mousestep.X, mousestep.Y
If mousestep.X > moulast.X And mousestep.Y > moulast.Y Then
Timer1.Enabled = False
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End If
End Sub
鼠标移动,句柄均无问题,但在激活的窗口中就是无法实现鼠标点击事件,求大神指点 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏15(财富值+成长值)
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询