VB 从零开始编外挂(五)

时间:2009-02-02 07:33:16  来源:第二电脑网  作者:第二电脑网

  第二电脑网导读:---------------------------------------------------------------------------------------------- 需要VB API函数: mouse_event ←模拟一次鼠标事件 -------------------------------------------------------------------------------------------------------------------------------------------------------- 相关API声明: mouse_event
  正文:vb 从零开始编外挂(五)

前边谈了模拟键盘,下面说说模拟鼠标
--------------------------------------------------------------------------------------------------------------------------------------------------------
需要VB API函数:
mouse_event ←模拟一次鼠标事件
--------------------------------------------------------------------------------------------------------------------------------------------------------
相关API声明:
mouse_event

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 )
--------------------------------------------------------------------------------------------------------------------------------------------------------
定义变量:
Const MOUSEEVENTF_LEFTDOWN = &H2
Const MOUSEEVENTF_LEFTUP = &H4
Const MOUSEEVENTF_MIDDLEDOWN = &H20
Const MOUSEEVENTF_MIDDLEUP = &H40
Const MOUSEEVENTF_MOVE = &H1
Const MOUSEEVENTF_ABSOLUTE = &H8000
Const MOUSEEVENTF_RIGHTDOWN = &H8
Const MOUSEEVENTF_RIGHTUP = &H10
--------------------------------------------------------------------------------------------------------------------------------------------------------
MOUSEEVENTF_LEFTDOWN'鼠标左键按下
MOUSEEVENTF_LEFTUP'鼠标松开
MOUSEEVENTF_RIGHTDOWN '鼠标右键按下
MOUSEEVENTF_RIGHTUP'鼠标右键松开
--------------------------------------------------------------------------------------------------------------------------------------------------------
代码
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 )
Const MOUSEEVENTF_LEFTDOWN = &H2
Const MOUSEEVENTF_LEFTUP = &H4
Const MOUSEEVENTF_MIDDLEDOWN = &H20
Const MOUSEEVENTF_MIDDLEUP = &H40
Const MOUSEEVENTF_MOVE = &H1
Const MOUSEEVENTF_ABSOLUTE = &H8000
Const MOUSEEVENTF_RIGHTDOWN = &H8
Const MOUSEEVENTF_RIGHTUP = &H10
'这里是 鼠标左键按下 和松开两个事件的组合即一次单击
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
'模拟鼠标右键单击事件
mouse_event MOUSEEVENTF_RIGHTDOWN Or MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
'两次连续的鼠标左键单击事件 构成一次鼠标双击事件
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0

"VB 从零开始编外挂(五)"由第二电脑网原创提供,转载请注明:http://www.002pc.com/master/College/Language/VB/2009-02-02/8920.html


关键字:

关于《VB 从零开始编外挂(五)》文章的评论

站内搜索: 高级搜索

热门搜索: Windows style 系统 tr IP QQ CPU 安装 function 注册 if td