power-state

Detect system standby/sleep/hibernate from .NET Windows Service ?

In a Windows Service, I need to detect when the computer goes into sleep and when it wakes up, and run some code on these events. This needs to be done for sleep, standby and hibernate power modes. How do I do that ? ...

How to get SYSTEM_POWER_STATUS using Silverlight 2/3/4 ?

I have a Silverlight application running full screen. Is there a way i can display system power status ( basically battery indicator how much is remaining ? ) using silverlight? I tried following [DllImport("kernel32.dll")] private static extern long GetSystemPowerStatus(SYSTEM_POWER_STATUS lpSystemPowerStatus); But got error messa...