Regarding Suspended mode RRS feed

  • Question

  • Hi all, m a win mobile programmer. I've stuck up in a peculiar situation in which all of you must have gone through.
    My problem is, I am working on a reminder application on win mobile using C#, and have a number of queries.

    1. I need my application to wake up the device at a predetermined time.
         For this i have been using Pinvoke techniques and the CeRunAppAt() routine.
         Now here the problem is that the application executes at that predetermined time but, sadly so i am not able to bring the device out of standby/suspend. Some of you would suggest using system idle timer to keep the device awake, but that is not my cup of tea, as the reminder time could be anywhere between few minutes, hours to few days, or even months and years.

    So please, if anyone could help me with this particular problem, kindly mail me at swapnil.salunke@live.in

    2. I've come accross some posts which suggest registry modifications, but i'm new to that, and dont want to take any risks with the device malfunctioning cos of wrong registry values, so can anyone please guide me regarding safe registry operations??

    Thanks all in advance.. Please Help! Its Urgent!
    Tuesday, January 12, 2010 6:25 AM

All replies

  • It's not a good idea to duplicate your questions in this forum.  A lot of us read through all of the forums and duplicate questions tend to cause confusion.

    When your application is started from CeRunAppAtTime() while the device is suspended you have about 1 to three seconds to commit the device to being in a higher power mode before it resuspends.  For more information see http://www.codeproject.com/KB/mobile/WiMoPower1.aspx under a section titled "Wake up and work quietly."

    Don't make the registry modifications.
    It takes all the running you can do to stay in one place.If you want to get somewhere else,you must try to run at least twice as fast as that.
    Tuesday, January 12, 2010 11:53 AM
  • Sorry Joel but was in utter need and thought posting it at two locations would prompt a quick reply from as many fellow developers as i can.

    Would keep that in mind in the future about not posting duplicate entries..

    My question to you is, does CeRunAppAtTime() bring a device out of the suspend mode?

    I had gone through your above mentioned link before, but it was not quite clear from the code whether it would bring out the device from suspended mode. I'm new to this area of programming and certainly new to PInvokes and C++ style of programming.

    Hope you dont mind...
    Wednesday, January 13, 2010 5:50 AM
  • It usually brings the device out of suspended state, but I just remembered something. CeRunAppAtTime is deprecated and there is some varience in how some OEMs implement it making it less than reliable on some newer devices.  The replacement function to use is CeSetUserNotificationsEx
    It takes all the running you can do to stay in one place.If you want to get somewhere else,you must try to run at least twice as fast as that.
    Wednesday, January 13, 2010 2:48 PM
  • can u provide me with a sample about usage of CeSetUserNotificationsEx please
    Wednesday, January 13, 2010 5:19 PM
  • joel...you didnt reply...pls reply...i need help with that problem buddie
    Tuesday, January 26, 2010 5:41 PM
  •         public static extern IntPtr CeSetUserNotification(IntPtr hNotification, string application, SystemTime startTime,
                                                              UserNotification notification);
            public static extern int FileTimeToSystemTime(ref long lpFileTime, SystemTime lpSystemTime);
            public static extern int FileTimeToLocalFileTime(ref long lpFileTime, ref long lpLocalFileTime);
        public class UserNotification
            public int ActionFlags;
            public string DialogTitle;
            public string DialogText;
            public string SoundPath;
            public int MaxSoundPath;
            public IntPtr Reserved;
            public UserNotification()
                DialogTitle = String.Empty;
                DialogText = String.Empty;
                SoundPath = String.Empty;
                MaxSoundPath = 0;
                Reserved = IntPtr.Zero;
                ActionFlags = 0;
           public static void RunAppAtTime(string applicationEvent, DateTime startTime)
                long fileTimeUTC = startTime.ToFileTime();
                long fileTimeLocal = 0;
                UserNotification notification;
                notification = new UserNotification();
                notification.ActionFlags = 0;
                notification.Reserved = IntPtr.Zero;
                SystemTime systemStartTime = new SystemTime();
                FileTimeToLocalFileTime(ref fileTimeUTC, ref fileTimeLocal);
                FileTimeToSystemTime(ref fileTimeLocal, systemStartTime);
                CeSetUserNotification(IntPtr.Zero ,applicationEvent, systemStartTime, notification);

    It takes all the running you can do to stay in one place.If you want to get somewhere else,you must try to run at least twice as fast as that.
    Wednesday, January 27, 2010 4:10 AM