public void ChangeHibernateFileState(bool flag) { NativePowerManagementInterop.CallNtPowerInformation( (int)InformationLevel.SystemReserveHiberFile, ref flag, Marshal.SizeOf(typeof(bool)), IntPtr.Zero, 0); }
public SYSTEM_POWER_INFORMATION GetSystemPowerInfo() { NativePowerManagementInterop.CallNtPowerInformation( (int)InformationLevel.SystemPowerInformation, IntPtr.Zero, 0, out SYSTEM_POWER_INFORMATION sysPowerInfo, Marshal.SizeOf(typeof(SYSTEM_POWER_INFORMATION))); return(sysPowerInfo); }
public SYSTEM_BATTERY_STATE GetSystemBatteryState() { NativePowerManagementInterop.CallNtPowerInformation( (int)InformationLevel.SystemBatteryState, IntPtr.Zero, 0, out SYSTEM_BATTERY_STATE sysBatteryInfo, Marshal.SizeOf(typeof(SYSTEM_BATTERY_STATE))); return(sysBatteryInfo); }
public String GetLastWakeTime() { NativePowerManagementInterop.CallNtPowerInformation( (int)InformationLevel.LastWakeTime, IntPtr.Zero, 0, out ulong lastWakeTime, Marshal.SizeOf(typeof(ulong))); return(TimeSpan.FromTicks((long)lastWakeTime).ToString()); }