Private Type POINTAPI X As Long Y As Long End TypePrivate Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long Private Declare Function ScreenToClient Lib "user32" (ByVal hWnd As Long, lpPoint As POINTAPI) As Long dim tPoint as POINTAPI Call GetCursorPos(tPOINT) '获取鼠标光标的位置 Call ScreenToClient(对象名.hWnd, tPOINT) '转换坐标从屏幕坐标系到对象相对的坐标
Private Type POINTAPI
X As Long
Y As Long
End TypePrivate Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function ScreenToClient Lib "user32" (ByVal hWnd As Long, lpPoint As POINTAPI) As Long
dim tPoint as POINTAPI
Call GetCursorPos(tPOINT) '获取鼠标光标的位置
Call ScreenToClient(对象名.hWnd, tPOINT) '转换坐标从屏幕坐标系到对象相对的坐标
GetCursorPos就行了,ScreenToClient纯属画蛇添足