From: Harmon on
Dear all,

I'm working with a communication program. I found if I power off the PDA
when my program is in 'talking' state (sending and receiving RTP packets
using socket), the system will freeze and dead when I power on. So I decide
not to allowed power off during talking.

I could use SystemIdleTimerReset() to disable auto power off, but I don't
know how to prevent the manual power off. I know there must be a way, because
I see Tomtom could do it. Could anyone give me a hint?

Thanks in advance!

Yun

From: " ctacke/>" on
In many/most cases there is no way to intercept the interrupt generated by
the push of the power button at an app level and therefore no way to disable
it. You need to put in error handling to prevent a lockup from happening.
You can get notified when the device is powered back up, which is sometimes
useful, but that notification is unlikely to occur before other code begin
executing again.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--



"Harmon" <Harmon(a)discussions.microsoft.com> wrote in message
news:61D45948-96FA-4381-9789-F8D5DC25B6B7(a)microsoft.com...
> Dear all,
>
> I'm working with a communication program. I found if I power off the PDA
> when my program is in 'talking' state (sending and receiving RTP packets
> using socket), the system will freeze and dead when I power on. So I
> decide
> not to allowed power off during talking.
>
> I could use SystemIdleTimerReset() to disable auto power off, but I don't
> know how to prevent the manual power off. I know there must be a way,
> because
> I see Tomtom could do it. Could anyone give me a hint?
>
> Thanks in advance!
>
> Yun
>


From: eugn on
<ctacke/> пиÑ?ал(а):

> In many/most cases there is no way to intercept the interrupt generated by
> the push of the power button at an app level and therefore no way to disable
> it. You need to put in error handling to prevent a lockup from happening.
> You can get notified when the device is powered back up, which is sometimes
> useful, but that notification is unlikely to occur before other code begin
> executing again.

May be there is a chance to create some kind of background process that
could stay working when device being switched off?

From: " ctacke/>" on
No. When the device is off, the processor is not running, and therefore
nothing processes. You can set a notification to wake at some point in the
future, but that's it.

-Chris

"eugn" <greatsokol(a)gmail.com> wrote in message
news:1156839379.379648.236280(a)p79g2000cwp.googlegroups.com...
<ctacke/> ?????(?):

> In many/most cases there is no way to intercept the interrupt generated by
> the push of the power button at an app level and therefore no way to
> disable
> it. You need to put in error handling to prevent a lockup from happening.
> You can get notified when the device is powered back up, which is
> sometimes
> useful, but that notification is unlikely to occur before other code begin
> executing again.

May be there is a chance to create some kind of background process that
could stay working when device being switched off?


From: Yaroslav Goncharov on
To prevent device from suspending when user clicks the power button enter
the unattended mode:

PowerPolicyNotify ( PPN_UNATTENDEDMODE , TRUE )

Don't forget to exit unattended mode once you are done with the critical
part of your program.

--
Yaroslav Goncharov
Spb Software House, http://spbsoftwarehouse.com
Pocket PC Developer Network, http://pocketpcdn.com


"Harmon" <Harmon(a)discussions.microsoft.com> wrote in message
news:61D45948-96FA-4381-9789-F8D5DC25B6B7(a)microsoft.com...
> Dear all,
>
> I'm working with a communication program. I found if I power off the PDA
> when my program is in 'talking' state (sending and receiving RTP packets
> using socket), the system will freeze and dead when I power on. So I
> decide
> not to allowed power off during talking.
>
> I could use SystemIdleTimerReset() to disable auto power off, but I don't
> know how to prevent the manual power off. I know there must be a way,
> because
> I see Tomtom could do it. Could anyone give me a hint?
>
> Thanks in advance!
>
> Yun
>