c# Windows CE讀取電池電量的實(shí)現(xiàn)
作者:Shanmin
c# Windows CE讀取電池電量的實(shí)現(xiàn)向你介紹了如何使用代碼實(shí)現(xiàn)c# Windows CE讀取電池電量的功能。
c# Windows CE讀取電池電量的實(shí)現(xiàn)是如何的呢?讓我們來(lái)看看:
- [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讀取電池電量的實(shí)現(xiàn)
- 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讀取電池電量的實(shí)現(xiàn)
- c# Windows CE讀取電池電量的實(shí)現(xiàn)的調(diào)用:
- //c# Windows CE讀取電池電量的實(shí)現(xiàn)之取電量
- 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讀取電池電量的實(shí)現(xiàn)就向你介紹到這里,希望對(duì)你了解c# Windows CE讀取電池電量的實(shí)現(xiàn)有所幫助。
【編輯推薦】
責(zé)任編輯:仲衡
來(lái)源:
網(wǎng)易博客