Timer / auto-off issue

  • Thread starter Thread starter PCH
  • Start date Start date
P

PCH

I have a timer in a form running.

Say its going to run for 20minutes (or standby really) and then execute some
code (such as a messagebox).

works fine if the time is short.. but if the time is longer, and then ppc
turns itself off/sleep mode, then the timer never fires!

Any ideas?

Thanks
 
Well, you have two easy choices. You can either make sure it *doesn't* go
to sleep, although this will drain the battery and possibly annoy the user,
or make sure that the device wakes up and runs your code at the right time,
which is more complicated to do.

You can keep the device from going to sleep by P/Invoking
SystemIdleTimerReset().

You can use CeRunAppAtTime() to start an application, with a special string
on the command line, at a given time. You'd have to send a message to your
already running program if you need to have it notified.

Paul T.
 
Thanks for the info!

I found an example of the CeRunAppAtTime() option.

Only problem is they are using a ChrB() to convert a # to binary to get
values for the SYSTEMTIME function.

But the ChrB() function isnt supported by .net

I tried using just Chr() but i think / know it didnt work correctly.

Do you know of a complaint function in .net to replace chrb()?

Thanks
 
I guess I'd have to see the code to understand what it's trying to do...
The main thing you need to know is what ChrB() does. It returns an 8-bit
(non-Unicode) character based on a number (it does a type conversion,
essentially). I think that you should be able to simply cast a value to
achieve the same thing in C#, at least (I don't use VB.NET). Something
like:

charResult = (Byte)val;

Paul T.
 
Take a look at the OpenNETCF Notification library. It has CeRunAppAtTime
implemented
 
Back
Top