FROM : Jean-Daniel Dupas
DATE : Fri Jan 04 17:20:04 2008
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
DATE : Fri Jan 04 17:20:04 2008
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






Cocoa mail archive

