Public Declare Function WindowFromPoint Lib "user32" Alias "WindowFromPoint" (ByVal xPoint As Long, ByVal yPoint As Long) As Long Public Declare Function GetWindowRect Lib "user32" Alias "GetWindowRect" (ByVal hwnd As Long, lpRect As RECT) As Long WindowFromPoint 取得鼠标下的 窗体句柄 GetWindowRect 取得鼠标的矩形然后 鼠标位置 和 矩形的top 和 Left 相减就可以算出来了。
Public Declare Function GetWindowRect Lib "user32" Alias "GetWindowRect" (ByVal hwnd As Long, lpRect As RECT) As Long
WindowFromPoint 取得鼠标下的 窗体句柄
GetWindowRect 取得鼠标的矩形然后 鼠标位置 和 矩形的top 和 Left 相减就可以算出来了。