prevent idle or sleep mode

G

Guest

Greetings,
I am using a ce.net device with vb.net. I am trying to prevent the device
from going into a power save mode while my app is running. I have tried
SystemIdleTimerReset call , but it seems to have no effect. Can anyone help
me out here?
regards,
William
 
P

Paul G. Tobey [eMVP]

It does work, unless the device is going into some type of critical shut
down. What does your declaration for it look like? What device,
specifically, is it?

Paul T.
 
G

Guest

Paul,
Thank you for your response.
Here is my declaration:
<DllImport("coredll.dll")> Private Sub SystemIdleTimerReset()
End Sub

The unit I am using is a DAP Technologies CE5320LS running CE.NET V 4.20

William
 
P

Paul G. Tobey [eMVP]

I don't see anything wrong with that and I'm surprised it doesn't work. I'd
contact the device vendor and ask them how to accomplish what you want to do
on their device.

How often are you calling SystemIdleTimerReset() when the application is
running?

Paul T.
 
G

Guest

Thanks again for the response.
I am calling the reset every 2 minutes. The unit sleeps after 3 minutes.
William
 
G

Guest

According to Microsoft document:
(http://msdn.microsoft.com/library/d.../html/ppc_programming_pocket_pc_2002_lfyy.asp)

===========================================
You can override the automatic suspend that occurs when no user input has
occurred for a period of time. To prevent automatic power down, call the
Windows CE SystemParametersInfo function for each of the three time-out
values, SPI_GETBATTERYIDLETIMEOUT, SPI_GETEXTERNALIDLETIMEOUT, and
SPI_GETWAKEUPIDLETIMEOUT, as shown in the following code. Your application
must call the SystemIdleTimerReset function more frequently than any of the
nonzero time-out values.

DWORD batIdle, acIdle, wakeUpIdle, shortestIdle;
TCHAR szOutput[200];

// Get the values.
SystemParametersInfo(SPI_GETBATTERYIDLETIMEOUT,0,&batIdle,0);
SystemParametersInfo(SPI_GETEXTERNALIDLETIMEOUT,0,&acIdle,0);
SystemParametersInfo(SPI_GETWAKEUPIDLETIMEOUT,0,&wakeUpIdle,0);

// Determine which is the lowest nonzero value.
shortestIdle=batIdle;
shortestIdle=((acIdle>0)&&(acIdle<shortestIdle)) ? acIdle :
(((wakeUpIdle>0)&&(wakeUpIdle<shortestIdle)) ? wakeUpIdle : shortestIdle);

if (shortestIdle==0)
// If all values are zero, the device can never time out.
wsprintf(szOutput,_T("Battery Idle Timeout: %d\nAC Power Idle Timeout:
%d\nWakeup Idle Timeout: %d\nThe device will not time out."),batIdle, acIdle,
wakeUpIdle);
else
{
// Otherwise, you need to reset the idle timer more
// frequently than the lowest time-out value.
wsprintf(szOutput,_T("Battery Idle Timeout: %d\nAC Power
Idle Timeout: %d\nWakeup Idle Timeout: %d\nYou need to
call SystemIdleTimerReset at least every %d
sec"),batIdle, acIdle, wakeUpIdle, shortestIdle-1);
}
MessageBox(hWnd,szOutput,_T("Results"),MB_OK);
===========================================

I try to following the instruction in the document on a HHP Dolphin 9500,
seems like it does not work. Though batIdle, acIdle, wakeUpIdle are all 0,
device suspend anyway.
 

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