Avis Junior Poster

Joined: 07 Oct 2003 Posts: 510 Location: India
|
Posted: Oct 8th, 2003 04:11 AM Post subject: Get Cursor Position |
|
|
Add two labels (Label1 , Label2) and a timer (Timer1).
| Code: | Option Explicit
Private Type POINTAPI 'Declare types
x As Long
y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINTAPI) As Long 'Declare API
Dim z As POINTAPI 'Declare variable
Private Sub Form_Load()
Timer1.Interval = 1
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
GetCursorPos z 'Get Co-ordinets
Label1 = "x: " & z.x 'Get x co-ordinets
Label2 = "y: " & z.y 'Get y co-ordinets
End Sub |
|
|