• 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: Tue, 8 Jan 2008 13:41:44 +0530

Is anybody there?

Please reply.

Thanks,
Palav

On 1/5/08, parag vibhute <email@hidden> wrote:
> Hi,
>
> While going through code snippets given in QA, I observed that apple used *
> daemon* API to run process in background. In my cocoa application, I just
> added daemon(0,0) line in my main function & using LSUIElement, hide the
> application icon. Now even though dock icon is hidden, my application is
> able to trap logout/restart/shutdown in
> -(void)workspaceWillPowerOff:(NSNotification
> *)aNotification.  Want to know whether this way is correct? or is it having
> any drawback?
>
> Thanks for reply,
> Palav
>
>
> On Jan 4, 2008 9:50 PM, Jean-Daniel Dupas <email@hidden> wrote:
>
> > Le 4 janv. 08 à 16:46, parag vibhute a écrit :
> >
> > 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?
> >
> >
> > I did not try but addind a *kIOMessageSystemWillRestart case and a **
> > kIOMessageSystemWillPowerOff case in the switch statement should be
> > enough.*
> >
> >
> > Also then what should I use to trap logout event as did not find any info
> > regarding it in API reference?
> >
> >
> > Getting login/logout event from a command line tool is a bit tricky. You
> > have to use the System Configuration frameworks. But there is another Q&A
> > for this task ;-)
> >
> > http://developer.apple.com/qa/qa2001/qa1133.html
> >
> >
> >
> >
>
>
> --
>
> There are many things in your life that will catch your eye but only a few
> will catch your heart....pursue those'.
>


--

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: Andrew Farmer <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>)
 >Re: 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>)
 >Re: Trapping user shutdown/logout/restart in Cocoa/Foundation tool (From: "parag vibhute" <email@hidden>)

  • Prev by Date: Re: Error executing instruction "[NSBezierPath bezierPath]"
  • Next by Date: Re: Custom field editors
  • 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