Hi Richard,

Sorry, I thought you were looking for code to catch the wakeup rather than 
the power off.

BTW - the code I posted only works if your app was the active app at power 
off - that's what the "if (sysAppLaunchFlagSubCall & launchFlags): check is 
for.  If the sub call flag is enabled it means you are the active app.

Regards,
Bob

At 02:56 PM 3/19/2002 -0600, you wrote:
>Bob,
>Thanks for the info but that only works if your app is not already 
>loaded.  Here is the code I used to catch if the system has been turned 
>off then back on.
>
>static Boolean PreHandleEvent(EventPtr eventP)
>{
>static Boolean bPowerOff=false;
>Boolean handled;
>handled = false;
>
>if (bPowerOff)
>         { // we got an event after powering off
>           // so we have turned back on
>         // do whatever you need to do here
>         bPowerOff=false;
>         }
>
>if (eventP->eType == keyDownEvent)
>         {
>         if (eventP->data.keyDown.chr == vchrPowerOff)
>                 {
>                 bPowerOff=true;
>                 // the power has been turned off
>                 }
>         }
>
>return handled;
>}
>
>For this to work you will need to call PreHandleEvent before 
>SysHandleEvent in your AppEventLoop.
>
>
>At 07:14 PM 3/18/2002 -0600, you wrote:
>>At 06:31 PM 3/18/2002 -0600, Richard Bell wrote:
>>>How do I detect when the PDA has powered down (auto or manually) and 
>>>when it powers back on?  I've got an application that needs to put up 
>>>security if the PDA has been inactive for more than a given amount of time.
>>
>>In PilotMain you receive the sysAppLaunchCmdNotify launch code:
>>
>>             case sysAppLaunchCmdNotify:
>>             {
>>                 if (sysAppLaunchFlagSubCall & launchFlags)
>>                 {
>>                     SysNotifyParamType* parm = (SysNotifyParamType*) cmdPBP;
>>                     if (sysNotifyLateWakeupEvent == parm->notifyType)
>>                     {
>>                 ... device turned on while I was active app ...
>>                     }
>>                 }
>>
>>                 break;
>>             }
>>
>>Bob
>>
>>
>>--
>>For information on using the Palm Developer Forums, or to unsubscribe, 
>>please see http://www.palmos.com/dev/support/forums/
>
>
>
>--
>For information on using the Palm Developer Forums, or to unsubscribe, 
>please see http://www.palmos.com/dev/support/forums/



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to