Basic Univers
Procedure.l WindowRealWidth(Window.l, Width.l = #PB_Default)
Protected WindowID.l, Style.l, rc.Rect
If IsWindow(Window)
WindowID = WindowID(Window)
Style = GetWindowLong_(WindowID, #GWL_STYLE)
If Width > #PB_Default
rc\right = Width
Else
rc\right = WindowWidth(Window)
EndIf
If AdjustWindowRect_(rc, Style, GetMenu_(WindowID))
Width = rc\right - rc\left
EndIf
EndIf
ProcedureReturn Width
EndProcedure
Procedure.l WindowRealHeight(Window.l, Height.l = #PB_Default)
Protected WindowID.l, Style.l, rc.Rect
If IsWindow(Window)
WindowID = WindowID(Window)
Style = GetWindowLong_(WindowID, #GWL_STYLE)
If Height > #PB_Default
rc\bottom = Height
Else
rc\bottom = WindowHeight(Window)
EndIf
If AdjustWindowRect_(rc, Style, GetMenu_(WindowID))
Height = rc\bottom - rc\top
EndIf
EndIf
ProcedureReturn Height
EndProcedure
If OpenWindow(0, 0, 0, 320, 240, "")
Debug WindowRealWidth(0)
Debug WindowRealHeight(0)
Debug "---"
Debug WindowRealWidth(0, 600)
Debug WindowRealHeight(0, 400)
EndIf