Carbon Apple quit Event troubles
I'm working on a new emulator that is carbonized, but I'm having some difficulty with the Apple Quit Event Handler...
Here's my code...
pascal short AEQuit(const AppleEvent* aev, AppleEvent* reply, SInt32 refCon);
pascal short AEQuit(const AppleEvent* aev, AppleEvent* reply, SInt32 refCon)
{
Application.Terminate();
return noErr;
}
.......then later......
void NApplication::InstallAEHandlers()
{
short err;
AEEventHandlerUPP eventFunc;
/* eventFunc = NewAEEventHandlerUPP(AEQuit); */
err = AEInstallEventHandler(kCoreEventClass,kAEQuitApplication,eventFunc,0,false);
/* eventFunc = NewAEEventHandlerUPP(AEUnhandled); */
err = AEInstallEventHandler(kCoreEventClass,kAEOpenDocuments,eventFunc,0,false);
err = AEInstallEventHandler(kCoreEventClass,kAEPrintDocuments,eventFunc,0,false);
err = AEInstallEventHandler(kCoreEventClass,kAEOpenApplication,eventFunc,0,false);
}
The stuff commented it is what it's giving me a compiler error on. The compiler error is:
Error: function call 'NewAEEventHandlerUPP(pascal short (const AEDesc *, AEDesc *, long))' does not match 'NewAEEventHandlerUPP(pascal short (*)(const AEDesc *, AEDesc *, unsigned long))'
NApplication.cpp line 119 eventFunc = NewAEEventHandlerUPP(AEQuit);
and it says practically the same thing for the next one too.
Any thoughts?
Here's my code...
pascal short AEQuit(const AppleEvent* aev, AppleEvent* reply, SInt32 refCon);
pascal short AEQuit(const AppleEvent* aev, AppleEvent* reply, SInt32 refCon)
{
Application.Terminate();
return noErr;
}
.......then later......
void NApplication::InstallAEHandlers()
{
short err;
AEEventHandlerUPP eventFunc;
/* eventFunc = NewAEEventHandlerUPP(AEQuit); */
err = AEInstallEventHandler(kCoreEventClass,kAEQuitApplication,eventFunc,0,false);
/* eventFunc = NewAEEventHandlerUPP(AEUnhandled); */
err = AEInstallEventHandler(kCoreEventClass,kAEOpenDocuments,eventFunc,0,false);
err = AEInstallEventHandler(kCoreEventClass,kAEPrintDocuments,eventFunc,0,false);
err = AEInstallEventHandler(kCoreEventClass,kAEOpenApplication,eventFunc,0,false);
}
The stuff commented it is what it's giving me a compiler error on. The compiler error is:
Error: function call 'NewAEEventHandlerUPP(pascal short (const AEDesc *, AEDesc *, long))' does not match 'NewAEEventHandlerUPP(pascal short (*)(const AEDesc *, AEDesc *, unsigned long))'
NApplication.cpp line 119 eventFunc = NewAEEventHandlerUPP(AEQuit);
and it says practically the same thing for the next one too.
Any thoughts?
Quote:pascal short AEQuit(const AppleEvent* aev, AppleEvent* reply, SInt32 refCon);
This needs to return "pascal short *" (a pointer), not pascal short (a value).
Jeff

I'd guess that it's actually that you need a UInt32 final parameter rather than an SInt32.
Let us know
Let us know

Possibly Related Threads...
Thread: | Author | Replies: | Views: | Last Post | |
Why free memory on application quit? | Najdorf | 32 | 22,029 |
Jan 5, 2009 12:19 AM Last Post: Lycander |
|
Troubles with simple events in Pygame | perks | 4 | 4,679 |
Aug 27, 2007 10:23 PM Last Post: Malarkey |
|
apple drops 64-bit carbon support? | Leroy | 33 | 20,643 |
Jun 17, 2007 08:44 PM Last Post: OneSadCookie |
|
Interface Troubles | DylanE | 2 | 3,845 |
Nov 17, 2006 04:30 PM Last Post: DylanE |
|
Troubles With Dynamic Memory | Nick | 1 | 3,732 |
Sep 7, 2005 08:56 PM Last Post: Nick |