How do I get the position of the mouse on the whole screen.
Last edited by nuclear112; Aug 3rd, 2007 at 12:53 AM.
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
Private Type POINTAPI X As Long Y As Long End Type Private Declare Function GetCursorPos Lib "user32" _ (lpPoint As POINTAPI) As Long
Dim MousePos as POINTAPI GetCursorPos MousePos label1.caption = MousePos.x & ", " & MousePos.y
Thanks.
Last edited by nuclear112; Aug 3rd, 2007 at 12:52 AM.
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.
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
Forum Rules