title: Getting Battery Capacity in Windows with Python
body: <p>I am looking to figure out both the current Battery Capacity and the Design Capacity.</p>
  
  <p>So far what I could get to work is using the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa394074%28v=vs.85%29.aspx" rel="noreferrer">Win32_Battery() class</a> which doesn't give all the information I need (at least not on my system). I used the pure-python <a href="http://timgolden.me.uk/python/wmi/index.html" rel="noreferrer">wmi library</a> for that.</p>
  
  <p>On the other hand I found this which works <a href="https://stackoverflow.com/questions/6153860/in-python-how-can-i-detect-whether-the-computer-is-on-battery-power">In Python, how can I detect whether the computer is on battery power?</a>, but unfortunately it doesn't provide any information on Capacity neither.</p>
  
  <p>The <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa372661%28v=vs.85%29.aspx" rel="noreferrer">Battery Information structure</a> and the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa372671%28v=vs.85%29.aspx" rel="noreferrer">Battery Status structure</a> seem perfect for this. Now I know that I have to use the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa372699%28v=vs.85%29.aspx" rel="noreferrer">DeviceIoControl function</a> to do so and I found this <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/bb204769%28v=vs.85%29.aspx" rel="noreferrer">C++ code</a> that explains it a little. </p>
  
  <p>I would prefer something that simply uses ctypes and not the python win32api provided by <a href="https://pypi.python.org/pypi/pywin32" rel="noreferrer">pywin32</a>.
  If you have an idea how to do this in python please let me know!</p>
  
  <p>Thanks in advance.</p>