Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
form1.frm
Option Explicit
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim B As RECT
Dim A As POINTAPI
GetCursorPos A
GetWindowRect Form1.hwnd, B
'Lblx = X / Screen.TwipsPerPixelX
Lblx = A.X - B.Left
Lbly = A.Y - B.Top
Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As Long
Declare Function ReleaseCapture Lib "user32" () As Long
Declare Function GetCapture Lib "user32" () As Long
Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long