Search code examples
windows-vistapower-managementstandby

How can I determine why the machine came out of suspend?


I'd like to be able to determine, programmatically, why a Vista system came out of standby (S3). Any language is fine, though a .NET one would be best. I'm looking to put this code into an application that I'm working on.

I'm looking for reasons like "Media center wanted to record a program," "user input woke the machine," "windows update is scheduled to run," things like that. I searched on Google, Bing and MSDN, but I could only find things relevant to Windows Mobile.

Can anyone point me to a function or object that can provide this information?


Solution

  • A top level window gets a WM_POWERBROADCAST message when waking up, but you can only tell if it was automatic (Media center, windows update etc) or the user (Pressing power button etc)