NewWindow
NewWindow Create a window
#include <Windows.h> Window Manager
WindowPtr NewWindow(wStorage, rBounds, title, visFlag, wDefProcID,
behind, goAwayFlag, refCon );
Ptr wStorage ; address of a WindowRecord; NIL=allocate one
Rect *rBounds ; bounding rectangle in global coordinates
Str255 title ; address of p-string text for title line
Boolean visFlag ; TRUE=draw window; FALSE=suppress
short wDefProcID ; window definition ID (0= documentProc, etc.)
WindowPtr behind ; -1=in front; NIL=in back; else= window
Boolean goAwayFlag ; TRUE=window has a "close box
long refCon ; application- defined reference (or Handle, etc.)
returns address of initialized WindowRecord; 0= error
NewWindow creates a window and returns a WindowPtr for use in
subsequent Window Manager calls. It allocates memory for the structure and
content regions of the window and invokes the window definition function to
calculate those regions.
wStorage points to where the window should be stored. A value of NIL causes
the window storage to be allocated as a nonrelocatable object in the
heap.
Note: This parameter affects which function you should use when
you close the window. See Notes, below.
rBounds is a pointer to a Rect, in global coordinates, that defines the size and
position of the new window.
title is the address of a length-prefixed string that will be used as the
window's title in the window's drag region.
visFlag is a Boolean value specifying if the window is to be made visible
immediately. A value of FALSE performs the necessary memory
allocations, but suppresses the actual drawing of the window.
wDefProcID is the window definition ID identifying the function that draws the
window. Thus, this value identifies the overall look of the window.
The following IDs are system constants:
documentProc 0 Standard document window
dBoxProc 1 Alert box or modal dialog box
plainDBox 2 Plain box
altDBoxProc 3 Plain box with shadow
noGrowDocProc 4 Document window without size box
zoomDocProc 8 Document window w/ zoom box (no system constant)
zoomNoGrow 12 Document with zoom, but no size box (no constant)
rDocProc 16 Round-rect; curvature 16,16
rDocProc+1 17 Round-rect; curvature 4,4
rDocProc+2 18 Round-rect; curvature 6,6
rDocProc+3 19 Round-rect; curvature 8,8
rDocProc+4 20 Round-rect; curvature 10,10
rDocProc+5 21 Round-rect; curvature 12,12
rDocProc+6 22 Round-rect; curvature 20,20
rDocProc+7 23 Round-rect; curvature 24,24
See Window Types for a graphic display of these window types.
behind specifies the window's plane - whether it is in front or behind other
windows on the screen. It is one of:
-1 In front of all other windows (most common usage)
NIL Behind all other windows
else a WindowPtr; new window will go behind this one
goAwayFlag is a Boolean value specifying whether the window has a "close box”.
Set this to TRUE if you want this square button to be drawn in the top
left corner of the window's frame.
refCon is an application-specific reference number. It is set and used by
the application; the system does not care anything about it.
Returns: a WindowPtr (a.k.a. GrafPtr) identifying the new window. A value
of NIL indicates that the operation was unsuccessful. Cast the return
value as a WindowPeek to access the extra fields of the

Notes: The window's GrafPort is set the same as the default values used in the
OpenPort function, except that its font is set to the application's font
rather than the system font.
If wStorage is NIL (to allocate the window's WindowRecord on the heap),
use DisposeWindow to close the window and deallocate the storage. If
wStorage points to within your own data area (e.g., as an auto variable on
the stack), use CloseWindow to close it.