0
Reply

How to get Battery DesignCapacity

Szilard Suto

Szilard Suto

Aug 11 2010 11:19 AM
2.7k
First, sorry about my english, because i don't speak well.
I'm a beginner in C# and the .net world. I want to make a program, which get some information about the battery.(couse i want to learn)

My problem is, how to get the battery DesignCapacity get?
I tried it with this:

 ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from Win32_Battery");
foreach (ManagementBaseObject envVar in searcher.Get()) {
	Console.WriteLine(envVar["DesignVoltage"]);
	Console.WriteLine(envVar["DesignCapacity"]); }
The DesignVoltage is correctly on the screen, but de DesignCapacity is empty(null).

I tried some other programs, for example BatteryBar and Notebook Hardware Control and  these programs are correctly display the DesignCapacity. I want to use this property to calculate the battery wear level.

Thank you in advance.