Option Explicit
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINTAPI) As Long
'***********************
'THESE TWO FUNCTIONS RETURN THE POSITION ON THE SCREEN
'IN PIXELS, OF THE CURSOR
'EXAMPLE USAGE:
'Private Sub Form_MouseMove(Button As Integer, _
'Shift As Integer, X As Single, Y As Single)
' Label1.Caption = "X Screen Position = " & GetXCursorPos
' Label2.Caption = "Y Screen Position = " & GetYCursorPos
'End Sub
'***********************************
Public Function GetXCursorPos() As Long
Dim pt As POINTAPI
GetCursorPos pt
GetXCursorPos = pt.X
End Function
Public Function GetYCursorPos() As Long
Dim pt As POINTAPI
GetCursorPos pt
GetYCursorPos = pt.Y
End Function
Get Cursor Position
Code:
0 comments:
Post a Comment