Open Application Event
When the user opens your application, the Finder uses the
typically performs any needed initialization, and then begins to process
events. If your application supports high-level events, your application
receives the Open Application event.
To handle the Open Application event, your application should do just
what the user expects it to do when your application is opened. For example,
your application might open a new untitled window in response to an
Open Application event.
event. The Open Application event does not have any required parameters. This handler first calls an application- defined function called
listing of MyGotRequiredParams. This function checks to see if the Apple
event should not contain any required parameters so, if the Apple event does
contain any, the handler returns an error. Otherwise the handler opens a new
document window.
// A handler for the Open Application event
// Assuming inclusion of
#include <AppleEvents.h>
void DoNew (void);
{
myErr = MyGotRequiredParams( theAppleEvent);
if ( myErr)
return myErr;
else {
DoNew();
}
}
The MyGotRequiredParams function checks that all required parameters have been extracted from the Apple event.