Important: The information in this document is obsolete and should not be used for new development.
CloseWindow
Use theCloseWindow
procedure to remove a window if you allocated memory yourself for the window's window record.
PROCEDURE CloseWindow (theWindow: WindowPtr);
- theWindow
- A pointer to the window record of the window to be closed.
DESCRIPTION
TheCloseWindow
procedure removes the specified window from the screen and deletes it from the window list. It releases the memory occupied by all data structures associated with the window except the window record itself.If you allocated memory for the window record and passed a pointer to it as one of the parameters to the functions that create windows, call
CloseWindow
when you're done with the window. You must then call the Memory Manager procedureDisposePtr
to release the memory occupied by the window record.
Any pending update events for the window are discarded. If the window being removed is the frontmost window, the window behind it, if any, becomes the active window.
- WARNING
- If your application allocated any other memory for use with a window, you must release it before calling
CloseWindow
. The Window Manager releases only the data structures it created.- Also,
CloseWindow
assumes that any picture pointed to by the window record fieldwindowPic
is data, not a resource, and it calls the QuickDraw procedureKillPicture
to delete it. If your application uses a picture stored as a resource, you must release the memory it occupies with theReleaseResource
procedure and set thewindowPic
field toNIL
before closing the window.SEE ALSO
See Listing 4-17 on page 4-61 for an example that callsCloseWindow
to remove a window from the screen.See Listing 4-3 on page 4-28 for an example that calls
CloseWindow
to clean up memory when an attempt to create a new window fails.