Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm working on a simple C# Back-end App where I've to collect all the data related to battery which is connected to windows Device, Data about battery would be like "Battery Level" , "Battery Technology" , "Battery Power Source" , "Battery Voltage" , "Battery Health" etc.

What I have tried:

After a lot of internet search I couldn't find anything useful. The only option that is a little bit closer to my query is UWP Apps, But I'm not working on UWP app now. I'm working with Simple Console C# Application , Can any body help me to find out some good and useful API for battery management in windows?
Posted
Updated 19-Apr-18 0:13am

1 solution

See here: PowerStatus Class (System.Windows.Forms)[^] - that gives you the info you can get.
But some of the items you want aren't that simple: Health for example isn't really a "status" item, it's something that you can only assess over a series of charge / use cycles, and it's really an indicator of battery failure rather than health - and I don;t think windows records that info!

You may be able to get more info by querying WIN32 directly: Battery info from win32 api · GitHub[^] but even then, I don;t think you will get everything you want that easily.
 
Share this answer
 
Comments
Ammar Shaukat 19-Apr-18 6:55am    
I've already tried PowerStatus Class . It is not providing all the things i want. Let me do some work with Battery Info from Win32 API .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900