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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to