鼠标移动过大 急求帮助
我做的一个连连看辅助工具 比较颜色 然后拖动叠加:GetCursorPos p
hd = GetDC(0)
r = getpixel(hd, p.x, p.y)
s = getpixel(hd, p.x + 39, p.y)
If r = s Then
mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, cButt, dwEI
'将鼠标指针移到目标坐标
mouse_event MOUSEEVENTF_MOVE, 39, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
为什么鼠标移动不是39个像素?
而且它不会释放左键 一直单击着 求高手解答一下啊 --------------------编程问答-------------------- 改用AutoHotKey软件做 --------------------编程问答--------------------
'在网上搜了很多文章,发现MOUSEEVENTF_MOVE移动不准确。
'经过研究,以下方法可使鼠标向右精确移动100象素。
Option Explicit
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI_) As Long
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)
Private Const MOUSEEVENTF_ABSOLUTE =
Const MOUSEEVENTF_MOVE =
Private Type POINTAPI_
X As Long
Y As Long
End Type
Private Sub Command1_Click()
Dim pt As POINTAPI_, Sw As Long, Sh As Long
Call GetCursorPos(pt)
Sw = Screen.Width / Screen.TwipsPerPixelX
Sh = Screen.Height / Screen.TwipsPerPixelY
mouse_event MOUSEEVENTF_MOVE Or MOUSEEVENTF_ABSOLUTE, (100 + pt.X) * 65535 / Sw, pt.Y * 65535 / Sh, 0&, 0
End Sub
原文地址:
http://www.google.cn/search?client=aff-cs-maxthon&forid=1&ie=utf-8&oe=UTF-8&hl=zh-CN&q=MOUSEEVENTF_MOVE
直接GOOGLE搜索MOUSEEVENTF_MOVE后的第一个结果. --------------------编程问答-------------------- 学习 --------------------编程问答-------------------- 学习之 --------------------编程问答-------------------- 这得看你的游戏了,如果你的游戏是全屏方式的,那么及有可能分辨率已经不是桌面分辨率了,所以像素也不对了
补充:VB , API