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: Programmer's Guide to MacApp / Part 1 - MacApp Theory and Architecture
Chapter 4 - Launching and Terminating an Application


Overview

A user can launch a MacApp application in the usual ways: by double-clicking the application icon, by double-clicking a document icon that belongs to the application, by selecting the application and choosing Open from the file menu, and so on. Another application or script can also open the application by sending an Open Application event that specifies the application.

When the operating system launches a MacApp application, it passes control to the application's main routine, which must be supplied by the developer. The main routine will vary from application to application, but it should always perform these operations:

Figure 4-1 shows these steps.

Each of the sample applications distributed with MacApp provides an example of a main routine. The main routine from the Calc application shows a startup screen when the application is launched. The main routine from the IconEdit application demonstrates the basic steps.

void main()
{
   InitUMacApp(4);// Initialize MacApp with 4 calls to MoreMasters.
   InitUPrinting();

   TIconEditApplication* anIconEditApplication = new
                                    TIconEditApplication;
   anIconEditApplication->IIconEditApplication();
   anIconEditApplication->Run();
}
The remainder of this chapter describes MacApp's facilities for initializing, running, and terminating an application.

Figure 4-1 Initializing and running a MacApp application from the main routine


Previous Book Contents Book Index Next

© Apple Computer, Inc.
25 JUL 1996