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


Creating and Initializing the Application Object

The main routine's final task is to instantiate and initialize an application object. You define a subclass of one of MacApp's application classes to serve as the application object. The code for creating and initializing the application object looks something the following:

TYourApplication* aYourApplication;
aYourApplication = new TYourApplication;
aYourApplication->IYourApplication();
In the IYourApplication method, you call IApplication with a line like the following:

this->IApplication(kFileType, kSignature);
The constants kSignature and kFileType specify an application signature and file type, used by the Macintosh Operating System to identify an application and the files that belong to it. Each application has just one signature but can have many file types, one for each type of file it supports.

IMPORTANT
Apple's Developer Technical Services (DTS) manages a registry of application signatures and file types. You should register your values with DTS so they won't conflict with those used in other applications. You can register types at the World Wide Web location http://dev.info.apple.com/cftype/main.html.
The IApplication method performs the following initialization tasks for the application:

After calling IApplication, the IYourApplication method takes care of any initialization specific to your application. That may include using the MA_REGISTER_CLASS macro to register your view classes. (The MA_REGISTER_CLASS macro is described in Chapter 8, "Displaying, Manipulating, and Printing Data.")

The next section describes the final steps for initializing MacApp.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
25 JUL 1996