Example Code

Calling the GetSystemPowerStatus Function in Kernel32.dll Using the Call Library Function Node

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview
This example VI shows how retrieve information from GetSystemPowerStatus msdn function

Description
GetSystemPoweStatus function retrieves the power status of the system. The status indicates whether the system is running on AC or DC power, whether the battery is currently charging, how much battery life remains, and if battery saver is on or off.
https://msdn.microsoft.com/it-it/library/windows/desktop/aa372693(v=vs.85).aspx

 

Requirements
LabVIEW 2012 (or Compatible)

 

Steps to Implement or Execute Code
Run the Vi

 

Additional Information or References

VI Block Diagram

GetSystemPowerStatus Kernel32 dll LV_2012_NI_Verified.png

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.