Syntax
CountWindows()
Remarks
Returns the number of open document and macro-editing windows, which is also the number of windows listed on the Window menu.
Example
This macro arranges windows side by side instead of stacking them as the Arrange All command (Window menu) does:
Sub MAIN
yours$ = WindowName$() 'Note which window is active
If DocMaximize() Then DocRestore 'Can't resize if maximized
fullwidth = Val(AppInfo$(6)) 'Get workspace width
fulldepth = Val(AppInfo$(7)) 'Get workspace depth
width = fullwidth / CountWindows()
For wnd = 1 To CountWindows() 'Move each window, resize it
x = width *(wnd - 1)
If DocMinimize() Then DocRestore 'Can't resize if minimized
DocMove x, 0
DocSize width, fulldepth - 1
NextWindow
Next wnd
Activate yours$ 'Reactivate original window
End Sub
See Also
WindowName$(), WindowNumber