vb获取鼠标在屏幕上的坐标并显示文本框1中
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励20(财富值+成长值)
2个回答
展开全部
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI '定义点(Point)结构
X As Long '点在X坐标(横坐标)上的坐标值
Y As Long '点在Y坐标(纵坐标)上的坐标值
End Type
Sub PrintCursorPos()
Dim dl As Long
Dim MyPoint As POINTAPI
dl& = GetCursorPos(MyPoint) '调用函数,获取屏幕鼠标坐标'
Debug.Print "X=" & Str(MyPoint.X) & " and " & "Y=" & Str(MyPoint.Y)
Print "当前横坐标:" & Str(MyPoint.X)
Print "当前纵坐标:" & Str(MyPoint.Y)
End Sub
Private Sub Timer1_Timer()
Cls
PrintCursorPos
End Sub
望采纳。。。。
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
定义,
Type POINTAPI
X As Long
Y As Long
End Type
Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
调用,
Dim typPt As POINTAPI
Call GetCursorPos(typPt)
Text1.Text = typPt.X & "," & typPt.Y
Type POINTAPI
X As Long
Y As Long
End Type
Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
调用,
Dim typPt As POINTAPI
Call GetCursorPos(typPt)
Text1.Text = typPt.X & "," & typPt.Y
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询