c# Windows CE读取电池电量的实现是如何的呢?让我们来看看:
- [DllImport("coredll.dll")]
- public static extern uint
- GetSystemPowerStatusEx2(
- ref SYSTEM_POWER_STATUS_EX2 pSystemPowerStatusEx2,
- int dwLen, int fUpdate);
- public struct SYSTEM_POWER_STATUS_EX2
- { //c# Windows CE读取电池电量的实现
- public byte ACLineStatus;
- public byte BatteryFlag;
- public byte BatteryLifePercent;
- public byte Reserved1;
- public uint BatteryLifeTime;
- public uint BatteryFullLifeTime;
- public byte Reserved2;
- public byte BackupBatteryFlag;
- public byte BackupBatteryLifePercent;
- public byte Reserved3;
- public uint BackupBatteryLifeTime;
- public uint BackupBatteryFullLifeTime;
- public uint BatteryVoltage;
- public uint BatteryCurrent;
- public uint BatteryAverageCurrent;
- public uint BatteryAverageInterval;
- public uint BatterymAHourConsumed;
- public uint BatteryTemperature;
- public uint BackupBatteryVoltage;
- public byte BatteryChemistry;
- }
- //c# Windows CE读取电池电量的实现
- c# Windows CE读取电池电量的实现的调用:
- //c# Windows CE读取电池电量的实现之取电量
- WinCE.SYSTEM_POWER_STATUS_EX2 status = new
- WinCE.SYSTEM_POWER_STATUS_EX2();
- hr=WinCE.GetSystemPowerStatusEx2(ref status,
- System.Runtime.InteropServices.Marshal.SizeOf(status), 1);
c# Windows CE读取电池电量的实现就向你介绍到这里,希望对你了解c# Windows CE读取电池电量的实现有所帮助。
【编辑推荐】