home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / source / appkill.cpt / aevent.c next >
Encoding:
C/C++ Source or Header  |  1992-03-15  |  1.2 KB  |  58 lines

  1. /*
  2. ** aevent.c
  3. **
  4. ** This module contains all the code for the program to handle the
  5. ** required Apple Events.  Of the four types, only two really
  6. ** pertain to the program (open and quit) with quit
  7. ** being the only used.
  8. */
  9.  
  10. #ifndef THINK_C
  11.  /* #include <all the macintosh headers... */
  12. #include <AppleEvents.h>
  13. #include <Desk.h>
  14. #include <Dialogs.h>
  15. #include <Events.h>
  16. #include <Fonts.h>
  17. #include <GestaltEqu.h>
  18. #include <Menus.h>
  19. #include <OSEvents.h>
  20. #include <QuickDraw.h>
  21. #include <ToolUtils.h>
  22. #include <Types.h>
  23. #include <Windows.h>
  24. #else
  25.  #include "ak_headers"
  26. #endif
  27. #include "aevent.h"
  28. #include "appkiller.h"
  29.  
  30.  
  31. static OSErr QuitHandler(AppleEvent, AppleEvent, long);
  32.  
  33.  
  34. void InitAEs(void)
  35. {
  36.     OSErr err;
  37.     
  38.     /* install event handlers for the core apple events. */
  39.     err = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
  40.                 QuitHandler, 0, FALSE);
  41. } /* InitAEs() */
  42.  
  43.  
  44. void DoAppleEvent(EventRecord *theEvent)
  45. {
  46.     OSErr err;
  47.     err = AEProcessAppleEvent(theEvent);
  48. } /* DoAppleEvent() */
  49.  
  50. /*===================================  HANDLERS FOLLOW... */
  51.  
  52. static OSErr QuitHandler(AppleEvent theAppleEvent,
  53.                 AppleEvent reply, long handlerRefcon)
  54. {
  55.     Cleanup();
  56. } /* QuitHandler() */
  57.  
  58.