From: Harmon on
Thank you, I'll have a try!

"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(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
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(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: Yaroslav Goncharov on
Yes, your application should continue working even if screen is off.

I think that your device suspends because of idle suspend timeout, not
because of the power button. Try to call SystemIdleTimerReset every 30
seconds to fix the problem.

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


"eugn" <greatsokol(a)gmail.com> wrote in message
news:1158049979.472921.323380(a)e3g2000cwe.googlegroups.com...
> 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(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
>> >
>