Timer and Suspend mode

  • Thread starter Thread starter Dan Diephouse
  • Start date Start date
D

Dan Diephouse

Hi,

I have a timer going, but I still want it to fire when the device is
suspended (off) and is traveling, say in someone's pocket. Like how the
pocket pc Inbox app checks mail every x many minutes - even if the
device is in your pocket. Is this possible with the stock CF.NET timer?
If not, is there another way?

Thanks,

Dan Diephouse
 
Okay, I figured out that I need to use the CeRunAppAtTime() function,
but I am trying to figure how I can turn that running of an application
into an execution of my method in another app.

I figured out how to check if my application is being launched again
(via the RunAppAtTime() and
http://wiki.opennetcf.org/ow.asp?CompactFrameworkFAQ), but I just want
to send my original application a message telling it to do something.
Any ideas?

- Dan
 
You will need to write a small helper application (command-line CF project)
that will be specified as a target of CeRunAppAtTime (or CeRunAppAtEvent)
and upon being launched will send a message to the main app. Usually you
would want a registered message that you could simply broadcast (i.e. send
to all top-level windows). On the receiving side create a MessageWindow
(derive your own class) to receive broadcast messages
 
Dan,

I looked at the wiki - a word about the choice of the message number. It
should really be done by calling RegisterWindowMessage on both end.
Broadcasting a message in a range between WM_USER and 0xc000 is a bad idea -
can crash some apps
 
Alex,

Thanks for the heads up - I am totally ignorant in this area :-) I
thought it just needed to be above WM_USER. I will post an update saying
that it should be above 0xc00 and figure out the bit about
RegisterWindowMessage.

- Dan
 
Back
Top