Carbon Apple quit Event troubles

deekpyro
Unregistered
 
Post: #1
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?
Quote this message in a reply
jefftkd
Unregistered
 
Post: #2
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 Cool
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
I'd guess that it's actually that you need a UInt32 final parameter rather than an SInt32.

Let us know Smile
Quote this message in a reply
deekpyro
Unregistered
 
Post: #4
It turns out it was the UInt32 that fixed my problem...well not exactly. I'm not getting compiler errors on it anymore but when I run it in X it doesn't quit from the programs application menu!!! Any ideas why?
Quote this message in a reply
Post Reply 

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