本篇内容主要讲解“c# Windows CE读取电池电量的实现方法”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“c# Windows CE读取电池电量的实现方法”吧!
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读取电池电量的实现方法”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。