怎么用VB模拟鼠标的点击啊
我想用VB模拟鼠标在屏幕上的点击,我已经尝试了如下代码:1、声明APIPublicDeclareSubmouse_eventLib"user32"(ByValdwFlag...
我想用VB模拟鼠标在屏幕上的点击,我已经尝试了如下代码:
1、声明API
Public 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)
Public Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal y As Long) As Long
2、
在Timer里添加如下代码:
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
可是Timer的Enable属性也是Ture,时间间隔是0.5秒。可是当我把鼠标指针移到某个按钮上时,并没有点击那个按钮。
到底怎么回事儿啊? 展开
1、声明API
Public 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)
Public Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal y As Long) As Long
2、
在Timer里添加如下代码:
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
可是Timer的Enable属性也是Ture,时间间隔是0.5秒。可是当我把鼠标指针移到某个按钮上时,并没有点击那个按钮。
到底怎么回事儿啊? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询