Prevent Sleep Mode

D

dav.olivares

I've an application that has to be running always. I've a problem when
sleep mode activates. I've tried different ways without success in a
Symbol MC35 (WM5 and CF2)

1. SystemIdleTimerReset in time intervals doesn't work.
2. I've modified the registry entries:

ControlPanel\BackLight DimACTimeout and DimBatteryTimeout.
System\CurrentControlSet\Control\Power\Timeouts ACSuspendTimeout and
BattSuspendTimeout

but changes doesn't take effect, I've tried to send a message to
reload the values without success:

SendMessage(hwnd_broadcast, wm_settingchange, 0, "System
\CurrentControlSet\Control\Power\Timeouts")
SendMessage(hwnd_broadcast, wm_settingchange, 0,
"ControlPanel\BackLight")

Dou you have any idea about to solve that?

Thank you
 
P

Paul G. Tobey [eMVP]

SystemIdleTimerReset() should absolutely prevent the system from ever
thinking that it's idle. I don't think that it can 'fail'. Perhaps your
code that calls it is not being called frequently enough to head off the
suspend?

Paul T.
 
D

dav.olivares

Thank you Paul,

yes, it was the first to try but it doesn't work.
I've tried handle = SetPowerRequirement("BKL1:",
PowerState.D0, 1, IntPtr.Zero, 0)
but it works only when it's cable connected but not if it's only by
battery.
 
P

Paul G. Tobey [eMVP]

You lost me big time there. What does calling SetPowerRequirement() have to
do with anything? I've tested SystemIdleTimerReset() in all configurations
of a couple of versions of Windows CE and it operates exactly the way you'd
expect it to. Of course, if you're on A/C power, then the time-out will
occur at the A/C power setting from the registry that was set when the
system started up and, when on battery, the battery time-out.

Paul T.

Thank you Paul,

yes, it was the first to try but it doesn't work.
I've tried handle = SetPowerRequirement("BKL1:",
PowerState.D0, 1, IntPtr.Zero, 0)
but it works only when it's cable connected but not if it's only by
battery.
 
F

Fatih Iþýkhan

I've an application that has to be running always. I've a problem when
sleep mode activates. I've tried different ways without success in a
Symbol MC35 (WM5 and CF2)

1. SystemIdleTimerReset in time intervals doesn't work.
2. I've modified the registry entries:

ControlPanel\BackLight   DimACTimeout and DimBatteryTimeout.
System\CurrentControlSet\Control\Power\Timeouts  ACSuspendTimeout and
BattSuspendTimeout

but changes doesn't take effect, I've tried to send a message to
reload the values without success:

            SendMessage(hwnd_broadcast, wm_settingchange, 0, "System
\CurrentControlSet\Control\Power\Timeouts")
            SendMessage(hwnd_broadcast, wm_settingchange, 0,
"ControlPanel\BackLight")

Dou you have any idea about to solve that?

Thank you

Try checking out on Settings->System->Power->Advanced "Turn off device
if not used for n minutes".
That should work for you.
 
D

dav.olivares

After many test and making reset to the device SystemIdleTimerReset
works.

Thanks to all.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top