• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Receive notifications about frontmost application change
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: Receive notifications about frontmost application change (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: Why can't I name a property `tag'?
  • Next by Date: Drawing issues in custom view
  • Previous by thread: Re: Receive notifications about frontmost application change
  • Next by thread: how to get the status of network when the network is set disable.
  • Index(es):
    • Date
    • Thread