Hi Michael,
Managed code:
You have Microsoft.WindowsMobile.Status
BatteryLevel batteryLevel = SystemState.PowerBatteryStrength;
BatteryState batteryState = SystemState.PowerBatteryState;
string batteryLevelText;
switch (batteryLevel)
{
case BatteryLevel.VeryLow:
batteryLevelText = "Battery Level: Very Low";
break;
case BatteryLevel.Low:
batteryLevelText = "Battery Level: Low";
break;
case BatteryLevel.Medium:
batteryLevelText = "Battery Level: Medium";
break;
case BatteryLevel.High:
batteryLevelText = "Battery Level: High";
break;
case BatteryLevel.VeryHigh:
batteryLevelText = "Battery Level: Very High";
break;
}
string batteryStateText = "Battery State: ";
if ((batteryState & BatteryState.Normal) == BatteryState.Normal)
batteryStateText += "Normal";
if ((batteryState & BatteryState.NotPresent) ==
BatteryState.NotPresent)
batteryStateText += "Not Present";
if ((batteryState & BatteryState.Charging) == BatteryState.Charging)
batteryStateText += "Charging";
if ((batteryState & BatteryState.Low) == BatteryState.Low)
batteryStateText += "Low";
if ((batteryState & BatteryState.Critical) ==
BatteryState.ChargCriticaling)
batteryStateText += "Critical";
Ref:
http://msdn2.microsoft.com/en-us/library/aa456240.aspx#yctiwy_snapi_part1_topic3
UnManaged:
[DllImport("coredll.dll", EntryPoint = "GetSystemPowerStatusEx",
SetLastError = true)]
private static extern bool
GetSystemPowerStatusEx(BatteryPowerStatus pStatus, bool flag);
Hope this helps,
Cheers,
Arun
Michael Meyer skrev:> Hi,
Define "check"?
You can read the BatteryLevel, BatteryState and such using
Microsoft.WindowsMobile.Status