Determine energy use programmatically in Windows?

Are there any features of the OS in Windows to find out that your system consumes electricity programmatically? (An ideal solution can be made through the WMI interface.)

+6
source share
2 answers

Starting with Windows 7, you can use the Win32_PowerMeter WMI class located in the root\CIMV2\power namespace, this namespace contains many other classes and events related to power management and profiles.

+6
source

I don't know anything on an instant basis, but GetSystemPowerStatus can give an estimate of the remaining battery power. A call that every few minutes (or something in that order) will give an idea of ​​how fast you use power, at least as a percentage of battery life. Of course, this really only works when / if there is a battery - on a desktop or server system it usually will not do anything.

+3
source

Source: https://habr.com/ru/post/910755/


All Articles