Page 1 of 1

PostPosted: Sun Apr 20, 2003 3:06 pm
by Glasswalker
Hello, Just a quick question, I searched the messageboard for this one but nothing was found...

I have a program with a module that handles a realtime clock that times events in a round robbin tournament... It handles data collection and other info...

The problem is this needs to run unattended while the device is on battery power... And the sleep timer keeps shutting the machine off...
This is a problem... because all processing pauses till it is turned back on, and there is a gap in the timing and data collection which breaks everything...

I need a way to reset the "sleep timer" on the machine so that it never sleeps as long as my program is running...

I know you can do that in the palm version, but how do I do it on wince?

Also... on a side note... I noticed that my backlight kicks out whenever certain dialogs pop up (alerts mainly). Is there a way to fix this too?


PostPosted: Sat Apr 26, 2003 12:04 pm
by Glasswalker
Does anybody know what to do here? this is important...

PostPosted: Sat Apr 26, 2003 2:58 pm
by KOU
Sorry if I misunderstood your question.

If the device is shutting down automatically, it is either battery or the setting.

You can change the shutdown setting in control panel. Probably "Power Management". (sorry, I'm using Japanese PocketPC)

If it is shutting down because of low battery, there will be no way to stop it.
If you are constantly using the CPU, it will be impossible to save the battery power.
When battery is low, it automatically shutdown the device.


PostPosted: Sat Apr 26, 2003 3:00 pm
by KOU
>>Also... on a side note... I noticed that my backlight kicks out whenever certain dialogs pop up (alerts mainly). Is there a way to fix this too?
Back light setting was on "contrast and brightness setting" in control panel.
Again, I'm using Japanese PocketPC. (Cassiopeia E700)

I don't know how to change it in program, but I am sure that this setting is in registry.


PostPosted: Sat Apr 26, 2003 4:00 pm
by Mickle
Generate keyboard events to keep device from auto-suspending:
Code: Select all
#define VK_NONAME       0xFC

#include "/PocketC/winuser.h" // or pcheader.h

#define TIMERID 100

   settimer(TIMERID, 10000);
   keyevent(VK_NONAME, 0, KEYEVENTF_KEYUP, 0);
   while (1)
      switch (event(0)) {
         case PM_TIMER:
            switch (timerid()) {
               case TIMERID: keyevent(VK_NONAME, 0, KEYEVENTF_KEYUP, 0); break;

PostPosted: Sat Apr 26, 2003 10:24 pm
by Glasswalker
Thanks Mickle....

The problem with the shutdown is that it has to run for an hour or so each time without interaction... I cannot set the setting on the control panel to anything longer than 10 minutes on my handheld... Also... I know it is not battery that is shutting it down, because it is on a fresh charge... and my battery can run (using the CPU full tilt, and using the backlight on full) for 10 hours easily... and it shuts off after the first few minutes...

Also: about the backlight...
The setting in the control panel for backlight is set to 1 minute... But it will change from on to off when I get an alert, or a confirm dialog box, even if it is after only 10 seconds... Also since I am interacting with the system regularly, it should never turn the backlight off, but it does... EVERY time there is an alert or confirm box... and sometimes when there is other dialogs...

Anyway... thanks for the help mickle... I was considering synthesizing keystrokes, but was unsure if that would work... I will try it. If anyone knows of a better solution then let me know...

PostPosted: Sun Apr 27, 2003 4:17 am
by Mickle
keyevent() must prevent backlight kicks out.
If you use CEAPI library:
SystemIdleTimerReset() instead keyevent() but it has no effect for backlight.
Get/Set settings from program:
Code: Select all
int seconds = 60;
// Set:
SystemParametersInfo(SPI_SETBATTERYIDLETIMEOUT, seconds, NULL, 1) ;
// Get
SystemParametersInfo(SPI_GETBATTERYIDLETIMEOUT, 0, &seconds, 0) ;

PostPosted: Mon Jul 14, 2003 5:56 am
by tutax
I am not sure if there is a function in CE version, but in Palm OS version of PocketC there is a function like resetaot() which resets the auto off timer.