如何利用vb实现像按键精灵的功能? 10
我将vb和ie浏览器结合起来,利用vb可以实现每隔一段时间在网页的指定位置上点击,这种内嵌浏览器和自动化怎样才能实现呢?求个思路!...
我将vb和ie浏览器结合起来,利用vb可以实现每隔一段时间在网页的指定位置上点击,这种内嵌浏览器和自动化怎样才能实现呢?求个思路!
展开
展开全部
用API函数来做。
Timer事件引发时,先用SetCursorPos函数设置鼠标位置(你所要指定的位置),然后用mouse_event函数引发Mouse点击事件(MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP)。
API函数声明及常量如下:
'设置鼠标位置
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
'获取鼠标位置
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) 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_MOVE = &H1 ' mouse move
Private Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
Private Const MOUSEEVENTF_RIGHTDOWN = &H8 ' right button down
Private Const MOUSEEVENTF_RIGHTUP = &H10 ' right button up
Timer事件引发时,先用SetCursorPos函数设置鼠标位置(你所要指定的位置),然后用mouse_event函数引发Mouse点击事件(MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP)。
API函数声明及常量如下:
'设置鼠标位置
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
'获取鼠标位置
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) 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_MOVE = &H1 ' mouse move
Private Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
Private Const MOUSEEVENTF_RIGHTDOWN = &H8 ' right button down
Private Const MOUSEEVENTF_RIGHTUP = &H10 ' right button up
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询