At 2:56 PM -0600 2002/03/19, Richard Bell wrote:
>Thanks for the info but that only works if your app is not already loaded.

The notification is sent to whatever application registered for the notification, 
regardless if that application is currently executing or not. Registering for one of 
the sysNotifySleepNotifyEvent or sysNotifyEarlyWakeupEvent or sysNotifyLateWakeupEvent 
events is the most reliable method of detecting when the OS powers off/on (independent 
of hacks and shared libraries' more restrictive methods of detection/notification 
anyway).

Note however, these notifications are only available in Palm OS 4.0 and later. Prior 
to OS 4, the most reliable methods of detecting device power-off/on were via a shared 
library's Sleep and Wake entry points (which unfortunately are extremely restrictive, 
as they're often called from within an interrupt service routine thus limiting what 
you can do from within the routine) or by detecting the vchrPowerOff virtual character 
just before it's passed to SysHandleEvent... just as your code demonstrates. Without 
patching SysHandleEvent, however, the latter approach requires your application to be 
the currently executing app in order to catch the power-off/on. And of course, 
patching SysHandleEvent has its own set of problems... including being unsupported in 
Palm OS 5 and later. :oP

Regards,

Jim Schram
PalmSource Inc.
Partner Engineering

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

Reply via email to