GetSystemPowerState

This function returns the current system power state currently in effect.

DWORD GetSystemPowerState(
  LPWSTR pBuffer,
  DWORD Length,
  PDWORD pFlags
);

Parameters

  • pBuffer
    [out] Buffer to receive the system power state name.

  • Length
    [out] Length of pBuffer in characters.

  • pFlags
    [out] Receives the system power state flags, which is the bitwise-OR of the POWER_STATE_XXX flags defined in Pm.h.

    The following table shows the various POWER_STATE_XXX flags.

    Flag Description
    POWER_STATE_ON On state
    POWER_STATE_OFF Off state
    POWER_STATE_CRITICAL Critical state
    POWER_STATE_BOOT Boot state
    POWER_STATE_IDLE Idle state
    POWER_STATE_SUSPEND Suspend state
    POWER_STATE_RESET Reset state

Return Values

Return value Description
ERROR_SUCCESS Successful call
ERROR_INSUFFICIENT_BUFFER Insufficient buffer
ERROR_NOT_FOUND Error is not found
Win32 error code All other errors

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Pm.h.
Link Library: Coredll.lib.

See Also

Power Management

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.