Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Processes
Chapter 2 - Process Manager / Process Manager Reference
Routines / Terminating Processes


Call ExitToShell to terminate your application directly.

The ExitToShell procedure terminates the calling process. The Process Manager removes your application from the list of open processes and performs any other necessary cleanup operations. In particular, all memory in your application partition and any temporary memory still allocated to your application is released. If necessary, the Application Died Apple event is sent to the process that launched your application.

If your application was the foreground process at the time it called ExitToShell, its name is removed from the Application menu. The Process Manager selects a new foreground process, switches it into the foreground, and propagates the scrap to the new foreground application.

If your application was the last one running and the shell program is not the Finder, the Process Manager displays a dialog box that gives the user the choice of restarting the computer or shutting it down.

Any trap patches installed by your application are removed immediately by ExitToShell. They will not affect any trap calls made by ExitToShell itself.

When ExitToShell exits, the system global variable DSErrCode holds its result code.

See "Terminating an Application" on page 2-11 for details on the parameters passed to the Application Died event.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
17 JUN 1996