ahmd0
ahmd0

Reputation: 17293

Determine power usage programmatically in Windows?

Are there any OS capabilities in Windows to know your system's current power usage programmatically? (Ideal solution could be via WMI interface.)

Upvotes: 6

Views: 4757

Answers (2)

RRUZ
RRUZ

Reputation: 136391

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

Upvotes: 6

Jerry Coffin
Jerry Coffin

Reputation: 490018

I don't know of anything on an instantaneous basis, but GetSystemPowerStatus can give an estimate of remaining battery power. Calling that every few minutes (or something on that order) would give an idea of how quickly you're using power, at least as a percentage of the battery life. Of course, that really only works when/if there is a battery -- on a desktop or server system it normally won't produce anything useful.

Upvotes: 3

Related Questions