Public Declare Function GetWindowRect Lib "user32" Alias "GetWindowRect" (ByVal hwnd As Long, lpRect As RECT) As Long Public Type RECT Left As Long Top As Long Right As Long Bottom As Long End Typedim r as rectGetWindowRect Me.hWnd , rDebug.Print r.Left , r.Top
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Typedim r as rectGetWindowRect Me.hWnd , rDebug.Print r.Left , r.Top
如果要转换为 Pixel 单位分别除以 Screen.TwipsPerPixelX、Screen.TwipsPerPixelY
Me.Caption = Me.Top \ 15 & ":" & Me.Left \ 15
End Sub