VB 从零开始编外挂(五)
2024-07-21 02:20:40
供稿:网友
前边谈了模拟键盘,下面说说模拟鼠标。
--------------------------------------------------------------------------------------------------------------------------------------------------------
需要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
本文来源于网页设计爱好者web开发社区http://www.html.org.cn收集整理,欢迎访问。