guangmin0622
|
分享:
▲
▼
哈哈哈~~ 小弟在大陆网站找到噜!
Option Explicit 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) 'dwFlags Long,下表中标志之一或它们的组合 'dx,dy Long,根据MOUSEEVENTF_ABSOLUTE标志,指定x,y方向的绝对位置或相对位置 'cButtons Long,没有使用 'dwExtraInfo Long,没有使用 'dwFlags常数 意义
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 '模拟鼠标右键抬起
Private Sub Form_Load() ' 1、这里是鼠标左键按下和松开两个事件的组合即一次单击: mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 ' 2、模拟鼠标右键单击事件: mouse_event MOUSEEVENTF_RIGHTDOWN Or MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0 ' 3、两次连续的鼠标左键单击事件 构成一次鼠标双击事件: mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 End Sub
|