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.
NotificationMon.ƒ/Source/AEvents.c
#include <AppleEvents.h> |
extern Boolean Done; |
pascal int AE_OpenApp( AppleEvent theAE, AppleEvent reply, long rfCon) |
{ |
return 0; |
} |
pascal int AE_OpenDoc( AppleEvent theAE, AppleEvent reply, long rfCon) |
{ |
return 0; |
} |
pascal int AE_PrintDoc( AppleEvent theAE, AppleEvent reply, long rfCon) |
{ |
return 0; |
} |
pascal int AE_QuitApp( AppleEvent theAE, AppleEvent reply, long rfCon) |
{ |
Done = true; /* set flag to indicate that program should quit */ |
return 0; |
} |
void DoHighLevelEvent(EventRecord *evt) |
{ |
int err; |
err = AEProcessAppleEvent(evt); |
if(err) |
{ |
error("\pError occured processing AE.",err); |
} |
} |
void InitAppleEvents() |
{ |
int err; |
err = AEInstallEventHandler (kCoreEventClass, kAEOpenApplication, AE_OpenApp,0,FALSE); |
if(err) |
{ |
error("\pCould not install AE handler.",err); |
ExitToShell(); |
} |
err = AEInstallEventHandler (kCoreEventClass, kAEOpenDocuments, AE_OpenDoc,0,FALSE); |
if(err) |
{ |
error("\pCould not install AE handler.",err); |
ExitToShell(); |
} |
err = AEInstallEventHandler (kCoreEventClass, kAEPrintDocuments, AE_PrintDoc,0,FALSE); |
if(err) |
{ |
error("\pCould not install AE handler.",err); |
ExitToShell(); |
} |
err = AEInstallEventHandler (kCoreEventClass, kAEQuitApplication, AE_QuitApp,0,FALSE); |
if(err) |
{ |
error("\pCould not install AE handler.",err); |
ExitToShell(); |
} |
} |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14