How to get the Power Status of the System

3 03 2009

description1

 

 

What you think about to make a simple program which displays the Battery power status of the Laptop. It is always showing in the taskbar of your laptop desktop by itself. But it is nice to show it by using our own simple application.

howcanidoit1

 

 

There is a Windows API function GetSystemPowerStatus for that. Which 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, and how much battery life remains.

mycodesnippet1

 

 

void GetMySystemPowerStatus()
{
  
   SYSTEM_POWER_STATUS sps={0};
  
   ::GetSystemPowerStatus(&sps);
}

mynote2

 

 

SYSTEM_POWER_STATUS structure contains information about the power status of the system. Please refer it in MSDN for details.

Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: