I originaly asked this question. Thanks to those who gave me clues.
here's how i manage to do that :
static void AppEventLoop(void){
Word error;
EventType event;
do{
EvtGetEvent(&event, evtWaitForever);
if (event.eType == keyDownEvent && (event.data.keyDown.chr ==
autoOffChr || event.data.keyDown.chr == hardPowerChr)){
// do what you want when power off
}
if (! SysHandleEvent(&event)){
if (! MenuHandleEvent(0, &event, &error)){
if (! AppHandleEvent(&event)){
FrmDispatchEvent(&event);
}
}
}
} while (event.eType != appStopEvent);
}
Stringer a écrit :
> >Subject: Re: Detecting power OFF event
> >From: "Alexander M. Budge" <[EMAIL PROTECTED]>
> >Date: Thu, 09 Nov 2000 11:08:03 -0500
>
> >I noticed in include/Core/System/Chars.h that there is a vchrAutoOff
> >virtual key code. I am new to the PalmOS, but I imagine that a
> >keyDownEvent pops out of EvtGetEvent before an auto-shutoff with this
> >KeyDown.chr. There is also a vchrPowerOff virtual key code which more
> >generally signals both hard-key and auto power-off occurances, but this
> >is only in PalmOS 3.2 and later.
>
> >Alex
>
> This issue has been discussed in previous threads.
>
> I believe the only reliable way to catch a power off event is to
> do it in a shared library as the OS sends a power off event to
> shared libraries. (Certainly for any program that want to run
> pre-OS3.5)
>
> Roger Stringer
> Marietta Systems, Inc.
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/