Detecting suspend

Discussion in 'Questions (Windows Mobile)' started by mundungus, May 19, 2009.

  1. mundungus

    mundungus New Member Licensed User

    Hi All,

    Is there a way to detect when the system goes to suspend/idle?

    I've been playing around with the GPSDriverDemo code.

    I have a problem where if I press the buttom that turns off the screen and sends the system to suspend, the timer throws an error "Error getting Device Status", "4319".

    I'm guessing that the suspend has caused the GPS driver to shutdown, But the timer is still executing and is calling the GetDeviceData function, which in turn causes this error.

    Is there a way I can stop this?

    Either by detecting that the system is suspending or that the driver has turned off?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    There is no way to detect when the system becomes idle.
    You can catch the error with ErrorLabel.
     
  3. eww245

    eww245 Member Licensed User



    I searched for quite a while for a way to detect if it's suspended.
    The only code I found was c++ and it's quite long.
    I would not be able to convert it to c#, even if it's possible.

    I am able to detect if the backlight has turned off.

    The method is able to detect idle and suspend, but doesn't seem to work.
    Probably because when it's suspended the program can't run.

    If it will help I'll put together a library and upload it here.
     
  4. mundungus

    mundungus New Member Licensed User

    Thanks all,

    I appreciate the offer of uploading the library. But its ok, no need to go to any trouble on my account (unless others can make use of it I guess).

    The ErrorLabel thing seems to be ok for my purposes right now. Well its stopping the nasty error message anyway.

    Seems strange though. I wonder how the suspend thing works. It seems to stop some functions from executing correctly, but doesn't stop a timer thread from executing.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice