home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Utilities / AppKiller 1.2 / src / aevent.c next >
Encoding:
C/C++ Source or Header  |  1993-05-16  |  2.0 KB  |  84 lines  |  [TEXT/ALFA]

  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. static pascal OSErr QuitHandler(AppleEvent*, AppleEvent*, long);
  31. static pascal OSErr OappHandler(AppleEvent*, AppleEvent*, long);
  32. static pascal OSErr OdocHandler(AppleEvent*, AppleEvent*, long);
  33. static pascal OSErr PrintHandler(AppleEvent*, AppleEvent*, long);
  34.  
  35.  
  36. void InitAEs(void)
  37. {
  38.     OSErr err;
  39.     
  40.     /* install event handlers for the core apple events. */
  41.     err = AEInstallEventHandler( kCoreEventClass, kAEQuitApplication,
  42.                 QuitHandler, 0, FALSE);
  43.     err = AEInstallEventHandler( kCoreEventClass, kAEOpenApplication,
  44.                 OappHandler, 0, FALSE);
  45.     err = AEInstallEventHandler( kCoreEventClass, kAEOpenDocuments,
  46.                 OdocHandler, 0, FALSE);
  47.     err = AEInstallEventHandler( kCoreEventClass, kAEPrintDocuments,
  48.                 PrintHandler, 0, FALSE);
  49. } /* InitAEs() */
  50.  
  51.  
  52. void DoAppleEvent(EventRecord *theEvent)
  53. {
  54.     OSErr err;
  55.     err = AEProcessAppleEvent(theEvent);
  56. } /* DoAppleEvent() */
  57.  
  58.  
  59. /*===================================  HANDLERS FOLLOW... */
  60.  
  61.  
  62. static pascal OSErr QuitHandler(AppleEvent *theAppleEvent,
  63.                 AppleEvent *reply, long handlerRefcon)
  64. {
  65.     Cleanup();
  66. } /* QuitHandler() */
  67.  
  68.  
  69. static pascal OSErr OappHandler(AppleEvent *theAppleEvent,
  70.                 AppleEvent *reply, long handlerRefcon)
  71. {
  72. }
  73.  
  74. static pascal OSErr OdocHandler(AppleEvent *theAppleEvent,
  75.                 AppleEvent *reply, long handlerRefcon)
  76. {
  77. }
  78.  
  79. static pascal OSErr PrintHandler(AppleEvent *theAppleEvent,
  80.                 AppleEvent *reply, long handlerRefcon)
  81. {
  82. }
  83.  
  84.