Beispiel #1
0
 public int BatteryLifePercent()
 {
     status = new SYSTEM_POWER_STATUS_EX();
     if (GetSystemPowerStatusEx(status, false) == 1)
     {
         return(status.BatteryLifePercent);
     }
     else
     {
         return(0);
     }
 }
Beispiel #2
0
 public bool UsingACPower()
 {
     status = new SYSTEM_POWER_STATUS_EX();
     if (GetSystemPowerStatusEx(status, false) == 1)
     {
         return(status.ACLineStatus == 1);
     }
     else
     {
         return(false);
     }
 }
Beispiel #3
0
 private static extern uint GetSystemPowerStatusEx(SYSTEM_POWER_STATUS_EX lpSystemPowerStatus, bool fUpdate);