[DllImport("coredll.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.U4)]
public static extern int GetSystemPowerStatusEx2(ref SYSTEM_POWER_STATUS_EX2 pSystemPowerStatusEx2, [MarshalAs(UnmanagedType.U4), In] int dwLen, [MarshalAs(UnmanagedType.Bool), In] bool fUpdate);
Declare Function GetSystemPowerStatusEx2 Lib "Coredll.dll" (TODO) As TODO
Do you know one? Please contribute it!
The return is the size of the structure. It returns 0 if there was an error.
Please add some!
SYSTEM_POWER_STATUS_EX2 SystemPowerStatusEx2 = new SYSTEM_POWER_STATUS_EX2();
if (GetSystemPowerStatusEx2(ref SystemPowerStatusEx2, Marshal.SizeOf(SystemPowerStatusEx2), true) > 0) {
//run some battery code
}