Click to Rate and Give Feedback
MSDN
MSDN Library
System Services
Power Management
 GetSystemPowerStatus Function

  Switch on low bandwidth view
GetSystemPowerStatus 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, and how much battery life remains.

Syntax

C++

BOOL WINAPI GetSystemPowerStatus(
  __out  LPSYSTEM_POWER_STATUS lpSystemPowerStatus
);

Parameters

lpSystemPowerStatus [out]

A pointer to a SYSTEM_POWER_STATUS structure that receives status information.

Return Value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0400 or later. For more information, see Using the Windows Headers.

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll

See Also

System Power Status
Power Management Functions
SYSTEM_POWER_STATUS

Send comments about this topic to Microsoft

Build date: 5/7/2009

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
vb.net syntax      dmex   |   Edit   |   Show History
<DllImport("kernel32.dll", CharSet:=CharSet.Auto, ExactSpelling:=True)> Public Shared Function GetSystemPowerStatus(<[In], Out> ByRef systemPowerStatus As SYSTEM_POWER_STATUS) As Boolean
End Function
Tags What's this?: Add a tag
Flag as ContentBug
C# syntax      dmex   |   Edit   |   Show History
[DllImport("kernel32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
public static extern bool GetSystemPowerStatus([In, Out] ref SYSTEM_POWER_STATUS systemPowerStatus);
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker