ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Check if on battery power

Solved!
Go to solution

Is there a way to check in LabVIEW (or otherwise) if a laptop is running on battery power?
The reason I would like to do this is that running on battery power would be indicative of a power outage in the field where we are testing, which would be problematic for other equipment.

 

Is there some function I can call in LabVIEW to check this? Or something I can call through the command prompt (Windows)?

Cory K
0 Kudos
Message 1 of 4
(3,232 Views)
Solution
Accepted by topic author Cory_K
Message 2 of 4
(3,227 Views)

Thanks Ravens Fan. That was exactly what I was looking for.

 

I just looked here for details about this dll, and this is what it says for

'ACLineStatus'

- 0 for offline

- 1 for online

 

So does 'offline' mean that the AC is offline, so it is running on battery?

Cory K
0 Kudos
Message 3 of 4
(3,213 Views)

By looking at the code, if the value =1 then it is on AC power (not =1 means on battery).  So offline means on battery.

 

 

Message 4 of 4
(3,210 Views)