Detecting suspend

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?
 

eww245

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?



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.
 

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.
 
Top