Re: How to prevent user to power off the PDA

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



First of all thank you for your attention and help! And please excuse
me for my bad English.

I've made a simple Win32 application which is increasing integer
variable every WM_TIMER event and drawing out this counter on the
screen.

At the beginning of application (WM_CREATE) I've placed a call of
PowerPolicyNotify (PPN_UNATTENDEDMODE ,TRUE) as you said. At the end
(WM_DESTROY) - PowerPolicyNotify (PPN_UNATTENDEDMODE ,FALSE).

Then I've started to observe for this counter powering on/off my PDA.

When I'm powering off my device, the counter is increasing for 20-30
seconds and then stops (It is starting to increase from a 20-30 points
greater value when I'm powering on again).

I've expected an application will continue to work when device was
powered off being in unattended mode.

So, what am I doing wrong?

Yaroslav Goncharov wrote:
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@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:61D45948-96FA-4381-9789-F8D5DC25B6B7@xxxxxxxxxxxxxxxx
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


.


Quantcast