vb强制将鼠标移动到指定位置上,比如(1000,1000)?
展开全部
先添加一模块,在其中声明:
Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
在窗体的代码中调用:
SetCursorPos X, Y '鼠标移动到屏幕坐标 X,Y(单位是像素)
追问
在声明部分前边加个Private就可以直接在窗体的通用部分使用
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
不过只在该窗体有效
追答
你声明到类文件里呀
展开全部
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) 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_LEFTDOWN = &H2
Private Const MOUSEEVENTF_LEFTUP = &H4
Private Sub Command1_Click()
SetCursorPos 1000, 1000
End Sub
追问
谢谢,但&H2和&H4是什么意思?
追答
&H2是微软规定的,用来表示left button down(左键按下)
&H4 left up弹起。。。这个程序我顺手复制来的。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询