Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
CoreSource/AEventCoreDisp.c
#include "CoreGlobals.h" |
pascal OSErr AEOpenApp( AppleEvent *theAE, AppleEvent *reply, long rfCon) |
{ |
return noErr; |
} |
pascal OSErr AEOpenDoc( AppleEvent *theAE, AppleEvent *reply, long rfCon) |
{ |
return errAEEventNotHandled; |
} |
pascal OSErr AEPrintDoc( AppleEvent *theAE, AppleEvent *reply, long rfCon) |
{ |
return errAEEventNotHandled; |
} |
pascal OSErr AEQuitApp( AppleEvent *theAE, AppleEvent *reply, long rfCon) |
{ |
gDone = true; /* set flag to indicate that program should quit */ |
return noErr; |
} |
void DoHighLevelEvent(EventRecord *evt) |
{ |
short err; |
err = AEProcessAppleEvent(evt); |
if(err) |
{ |
ErrMsgCode("\pError processing Apple Event in DoHighLevelEvent",err); |
} |
} |
void InstallAppleEvents(void) |
{ |
short err; |
err = AEInstallEventHandler (kCoreEventClass, kAEOpenApplication, AEOpenApp,0,FALSE); |
if(err) |
{ |
ErrMsgCode("\pCould not install AE handler.",err); |
ExitToShell(); |
} |
err = AEInstallEventHandler (kCoreEventClass, kAEOpenDocuments, AEOpenDoc,0,FALSE); |
if(err) |
{ |
ErrMsgCode("\pCould not install AE handler.",err); |
ExitToShell(); |
} |
err = AEInstallEventHandler (kCoreEventClass, kAEPrintDocuments, AEPrintDoc,0,FALSE); |
if(err) |
{ |
ErrMsgCode("\pCould not install AE handler.",err); |
ExitToShell(); |
} |
err = AEInstallEventHandler (kCoreEventClass, kAEQuitApplication, AEQuitApp,0,FALSE); |
if(err) |
{ |
ErrMsgCode("\pCould not install AE handler.",err); |
ExitToShell(); |
} |
} |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14