PDA

Click to See Complete Forum and Search --> : Finding cursor location relative to form...


Jun 15th, 2000, 02:29 AM
Put this code in the MouseMove event of the Form.


Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Cls
Print X & "," & Y
End Sub

kedaman
Jun 23rd, 2000, 07:20 PM
Here's some api for getting the position (in pixels) wherever you cursor is, just put a timer on your form and it's interval to something

Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Private Type POINTAPI
x As Long
y As Long
End Type

Private Sub Timer1_Timer()
Dim pa As POINTAPI
GetCursorPos pa
pa.x = -pa.x: pa.y = -pa.y
ClientToScreen hwnd, pa
pa.x = -pa.x: pa.y = -pa.y
Caption = pa.x & "," & pa.y
End Sub