0

I'm working on windows mobile 6.0 project using .NET CF and OpenNET CF. I'm looking to get the value of the battery from the battery life bar. Any help please?

Anouar
  • 75
  • 1
  • 12

1 Answers1

1

The 2.0 version of the SDF is really old and I don't know if it contained the classes specific for power monitoring.

If the old 1.4 code base, there is a control called the BatteryLife which can show the power level. The source for that control (which is simple) contains all of the P/Invokes to get the info.

The newer 2.3 code base has a PowerStatus class that gives the information you want.

You could also choose to directly P/Invoke yourself

[DllImport("codedll", SetLastError = true)]
internal static extern bool GetSystemPowerStatusEx2(
    PowerStatus pStatus, int dwLen, bool fUpdate);
ctacke
  • 66,480
  • 18
  • 94
  • 155