vb 鼠标定位并作出单击

vb6.0,怎么做,鼠标定位屏幕某处,并且作出双击和单击,我要的是代码(代码旁边有注释),不要在网上复制来的,邮箱752021851@qq.com,分我给你你能说得更清楚... vb6.0,怎么做,鼠标定位屏幕某处,并且作出双击和单击,我要的是代码(代码旁边有注释),不要在网上复制来的,邮箱752021851@qq.com,分我给你
你能说得更清楚些吗,我不是很懂
最好做个源码给我研究下,比如:我要把鼠标定位到某个坐标并作出单击,然后又到另外一处,
展开
 我来答
eagle38394516
2010-07-02 · 超过40用户采纳过TA的回答
知道小有建树答主
回答量:148
采纳率:0%
帮助的人:121万
展开全部
'读取鼠标位置
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
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式