2개의 Label 컨트롤과 하나의 Timer 컨트롤을 추가시킨다. Timer.interval 속성은 1로 준다.
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Dim z As POINTAPI
Private Sub Timer1_Timer()
GetCursorPos z
Label1 = "x: " & z.x
Label2 = "y: " & z.y
End Sub
Source Page : http://www.mentalis.org/tips/tip65.shtml