How do I get the position of the mouse on the whole screen.
Printable View
How do I get the position of the mouse on the whole screen.
Code:Private Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINTAPI) As Long
Code:Dim MousePos as POINTAPI
GetCursorPos MousePos
label1.caption = MousePos.x & ", " & MousePos.y
Thanks.
vb Code:
Private Declare Sub GetCursorPos Lib "User32" (lpPoint As POINTAPI) Private Type POINTAPI x As Long y As Long End Type Private Sub Form_Load() Timer1.Enabled = True Timer1.Interval = 50 End Sub Private Sub Timer1_Timer() Dim Rect As POINTAPI GetCursorPos Rect Label1.Caption = "X = " & Rect.x Label2.Caption = "Y = " & Rect.y End Sub
Use this with a timer to get it.