vb 鼠标定位并作出单击
vb6.0,怎么做,鼠标定位屏幕某处,并且作出双击和单击,我要的是代码(代码旁边有注释),不要在网上复制来的,邮箱752021851@qq.com,分我给你你能说得更清楚...
vb6.0,怎么做,鼠标定位屏幕某处,并且作出双击和单击,我要的是代码(代码旁边有注释),不要在网上复制来的,邮箱752021851@qq.com,分我给你
你能说得更清楚些吗,我不是很懂
最好做个源码给我研究下,比如:我要把鼠标定位到某个坐标并作出单击,然后又到另外一处, 展开
你能说得更清楚些吗,我不是很懂
最好做个源码给我研究下,比如:我要把鼠标定位到某个坐标并作出单击,然后又到另外一处, 展开
展开全部
'读取鼠标位置
Dim p As POINTAPI
Call GetCursorPos(p)
MsgBox "当前鼠标位置为:" + vbCrLf + "X坐标:" + LTrim(Str(p.x)) + vbCrLf + "Y坐标:" + LTrim(Str(p.y))
'控制鼠标位置
SetCursorPos X, Y '分别是X坐标和Y坐标
'左键落下
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
'左键抬起
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
'右键落下
mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
'右键抬起
mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
要用的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
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Public Const MOUSEEVENTF_MOVE = &H1 ' mouse move
Public Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Public Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
Public Const MOUSEEVENTF_RIGHTDOWN = &H8 ' right button down
Public Const MOUSEEVENTF_RIGHTUP = &H10 ' right button up
Public Type POINTAPI
x As Long
y As Long
End Type
Dim p As POINTAPI
Call GetCursorPos(p)
MsgBox "当前鼠标位置为:" + vbCrLf + "X坐标:" + LTrim(Str(p.x)) + vbCrLf + "Y坐标:" + LTrim(Str(p.y))
'控制鼠标位置
SetCursorPos X, Y '分别是X坐标和Y坐标
'左键落下
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
'左键抬起
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
'右键落下
mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
'右键抬起
mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
要用的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
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Public Const MOUSEEVENTF_MOVE = &H1 ' mouse move
Public Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Public Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
Public Const MOUSEEVENTF_RIGHTDOWN = &H8 ' right button down
Public Const MOUSEEVENTF_RIGHTUP = &H10 ' right button up
Public Type POINTAPI
x As Long
y As Long
End Type
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询