[DllImport("powrprof.dll", SetLastError=true)]
private static extern UInt32 CallNtPowerInformation(
Int32 InformationLevel,
IntPtr lpInputBuffer,
UInt32 nInputBufferSize,
IntPtr lpOutputBuffer,
UInt32 nOutputBufferSize
);
<DllImport("powrprof.dll", SetLastError := True)> _
Private Shared Function CallNtPowerInformation(InformationLevel As Int32, lpInputBuffer As IntPtr, nInputBufferSize As UInt32, lpOutputBuffer As IntPtr, nOutputBufferSize As UInt32) As UInt32
End Function
None.
Do you know one? Please contribute it!
None.
Please add some!
IntPtr status = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(SYSTEM_BATTERY_STATE)));
uint retval = CallNtPowerInformation(
5, // SystemBatteryState
(IntPtr)null,
0,
status,
(UInt32)Marshal.SizeOf(typeof(SYSTEM_BATTERY_STATE))
);
SYSTEM_BATTERY_STATE batt_status = (SYSTEM_BATTERY_STATE)Marshal.PtrToStructure(status, typeof(SYSTEM_BATTERY_STATE));