Re: how to get events from a carbon event handler, in a cocoa app.
Re: how to get events from a carbon event handler, in a cocoa app.
- Subject: Re: how to get events from a carbon event handler, in a cocoa app.
- From: Rosyna <email@hidden>
- Date: Thu, 14 Sep 2006 08:02:44 -0700
It should just work, but what events are you installing a handler
for? What is eventsToListenFor? Also, you don't *need* to use
NewEventHandlerUPP, you can just pass
LaunchTerminationNotifierProxyCallbackFunction. And you can pass NULL
for the last param if you are not going to remove this event handler
at any time.
Ack, at 9/14/06, Clayton John said:
here's my problem:
- I don't receive events from an installed carbon handler in my cocoa app.
- the app is actually a preferences bundle
the code i used to install the handler (ignoring decl'd vars and so
on) is this:
EventHandlerUPP launchTerminateCallbackUPP =
NewEventHandlerUPP(LaunchTerminationNotifierProxyCallbackFunction);
...
OSStatus functionResult =
InstallApplicationEventHandler(launchTerminateCallbackUPP,
2,
eventsToListenFor,
self,
&_eventHandle);
and that in turn is macro defined to this:
#define InstallApplicationEventHandler( handler, numTypes, list,
userData, outHandlerRef ) \
InstallEventHandler( GetApplicationEventTarget(), (handler),
(numTypes), (list), (userData), (outHandlerRef) )
meaning, I've installed a carbon event callback on the Application
Event Target.
So - my app never appears to have the callbacks get called - i.e.
the function launchTerminateCallbackUPP is never called (I've got
print statements in there), and when I start/stop applications I
never see anything.
the test app I stole this from, ObserveProcessLifeCarbon, works OK -
the main difference I see is that in the example application, they
explicitly kick off the carbon run loop via a call to
RunApplicationEventLoop - which isn't an option for me, since the
event loop is being handled by NSApplication / NSResponder type
API's.
Can anyone tell me how I am able to get this application event
listener working in a Cocoa app?
--
Sincerely,
Rosyna Keller
Technical Support/Holy Knight/Always needs a hug
Unsanity: Unsane Tools for Insanely Great People
It's either this, or imagining Phil Schiller in a thong.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden