Re: Receive notifications about frontmost application change
Re: Receive notifications about frontmost application change
- Subject: Re: Receive notifications about frontmost application change
- From: email@hidden
- Date: Thu, 10 Jul 2008 17:33:12 +0200
On 10 Jul 2008, at 5:16pm, Matt Neuburg wrote:
Copy and paste is pretty easy:
http://www.cocoabuilder.com/archive/message/cocoa/2006/2/4/156003
EventHandlerUPP handlerUPP = NewEventHandlerUPP(appSwitched);
InstallApplicationEventHandler (handlerUPP, 1, &eventType, self,
NULL);
DisposeEventHandlerUPP(appSwitched);
<The following is based on rusty knowledge, but I think it is correct >
Conceptually, you shouldn't call DisposeEventHandlerUPP until you have
finished with the handler (ie after calling RemoveEventHandler).
However in practice (in Mach-o) NewEventHandlerUPP is just a nop that
gives you back the normal function pointer. Theoretically Apple could
change it back for some future architecture in which case disposing it
would be a bad thing.
return(CallNextEventHandler(nextHandler, theEvent));
There is not any need to use CallNextEventHandler if you are not going
to do anything after it in your handler (but it is perfectly safe to
do so).
Simpler to do:
return eventNotHandlerErr;
and let the OS do the right thing.
Matt 'Whatever happened to WorkStrip' Gough
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden