• 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: Trapping user shutdown/logout/restart in Cocoa/Foundation tool
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trapping user shutdown/logout/restart in Cocoa/Foundation tool


  • Subject: Re: Trapping user shutdown/logout/restart in Cocoa/Foundation tool
  • From: "parag vibhute" <email@hidden>
  • Date: Fri, 4 Jan 2008 21:16:48 +0530

Hi,

Thanks for reply. I read QA1340 which you mentioned & after going throught
it got following API:
*
IORegisterForSystemPower
Connects the caller to the Root Power Domain IOService for the purpose of
receiving Sleep, Wake, ShutDown, PowerUp notifications for the System.*

Even though I have not implemented the code, I think above API will work for
Shutdown & Restart. Am I correct?

Also then what should I use to trap logout event as did not find any info
regarding it in API reference?

& yes I am using same thing i.e. LSUIElement to hide dock icon but as I told
if I hide the dock icon then couldn't able to trap restart/shutdown/logout
using *workspaceWillPowerOff *cocoa notification. So finding other
alternative. As you have suggested to use QA1340, I will use
*IORegisterForSystemPower
*for trapping shutdown/restart.



Thanks again,
Palav






On Jan 4, 2008 8:36 PM, Jean-Daniel Dupas <email@hidden> wrote:

>
> Le 4 janv. 08 à 15:38, parag vibhute a écrit :
>
> > Hi guys,
> >
> > I want to trap user user shutdown/logout/restart. For that I am using
> > -(void)workspaceWillPowerOff:(NSNotification *)aNotification. But
> > for this,
> > it is necessary to have dock icon of an application. I searched the
> > google &
> > came to know that it is required to have dock icon to trap
> > shutdown/restart/shutdown. My code is c++ code, but for  trapping
> > shudown/restart/logout only, I am wrapping that C++ code in cocoa. I
> > have
> > two questions:
> > 1. Is there any other way to trap shutdown/restart/logout without
> > requiring
> > to have type of project as Cocoa (i.e. either through Foundation
> > tool or
> > like that).
> > 2. Is there any way to trap shutdown/restart/logout in cocoa
> > application
> > without requiring to have dock icon of an application?
> >
> > Please reply.
> >
> > Thanks,
> > Palav
>
> 1. Look like you want to use IORegisterForSystemPower();
> This is plain C so it works in command line tools and in Cocoa
> Application.
> There is also a Q&A that explains how to use it
> http://developer.apple.com/qa/qa2004/qa1340.html
>
> 2. it probably works if you create a standard Cocoa Application and
> add the LSUIElement in the Info.plist.
> See
> http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/PListKeys.html
>  for details about this key.
>
> Regards
> Jean-Daniel




--

There are many things in your life that will catch your eye but only a few
will catch your heart....pursue those'.
_______________________________________________

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

  • Follow-Ups:
    • Re: Trapping user shutdown/logout/restart in Cocoa/Foundation tool
      • From: Jean-Daniel Dupas <email@hidden>
References: 
 >Trapping user shutdown/logout/restart in Cocoa/Foundation tool (From: "parag vibhute" <email@hidden>)
 >Re: Trapping user shutdown/logout/restart in Cocoa/Foundation tool (From: Jean-Daniel Dupas <email@hidden>)

  • Prev by Date: Re: nanotime()
  • Next by Date: Bundle Loading/Unloading at runtime
  • Previous by thread: Re: Trapping user shutdown/logout/restart in Cocoa/Foundation tool
  • Next by thread: Re: Trapping user shutdown/logout/restart in Cocoa/Foundation tool
  • Index(es):
    • Date
    • Thread