VB 如何用API mouse_event 函数实现鼠标相对移动? 100
例如:我想水平向右相对移动100像素,我用了Callmouse_event(MOUSEEVENTF_MOVE,100,0,0,0)可是为什么向右相对移动了200多像素?怎...
例如: 我想水平向右相对移动100像素,我用了Call mouse_event(MOUSEEVENTF_MOVE, 100, 0, 0, 0) 可是为什么向右相对移动了200多像素?怎么才能准确相对移动?还望高手不吝赐教 可以聊系我QQ271072330 多谢哦~ 最好要源码哦~一定要用它mouse_event移动 不要用 SetCursorPos设置坐标! 是相对移动 谢谢!
展开
3个回答
展开全部
'我还就给你SetCursorPos了,要不要?
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Sub Command1_Click()
Dim P1 As POINTAPI
GetCursorPos P1
screenx = P1.X
screeny = P1.Y
Call SetCursorPos(screenx + 100, screeny)
End Sub
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Sub Command1_Click()
Dim P1 As POINTAPI
GetCursorPos P1
screenx = P1.X
screeny = P1.Y
Call SetCursorPos(screenx + 100, screeny)
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
已通过短消息与人作了沟通。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
控制面板-鼠标-指针选项,取消勾选“提高鼠标指针精确度”
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询