how to get events from a carbon event handler, in a cocoa app.
how to get events from a carbon event handler, in a cocoa app.
- Subject: how to get events from a carbon event handler, in a cocoa app.
- From: Clayton John <email@hidden>
- Date: Thu, 14 Sep 2006 16:57:14 +0200
Hi All
The docs (CarbonCocoa integration guide) tell me that since 10.2,
carbon and cocoa event handlers work together - and cutting a long
story short, that life is full of roses when I mix the two in an app.
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?
Thanks
John Clayton
_______________________________________________
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