Applications can better adapt their behavior to the current power state of the computer by registering
for power events. Using the
RegisterPowerSettingNotification
function, applications can receive
PBT_POWERSETTINGCHANGE notifications either
with WM_POWERBROADCAST messages sent to a window (for
interactive applications) or through the HandlerEx callback
function registered with
RegisterServiceCtrlHandlerEx (for service
applications). The lParam parameter of the
WM_POWERBROADCAST message or the
lpEventData parameter sent to the
HandlerEx callback function is a pointer to a
POWERBROADCAST_SETTING structure.
Applications should register for each power change event that may impact their behavior. Here are some
common PowerSetting values.
- GUID_POWERSCHEME_PERSONALITY - 245d8541-3943-4422-b025-13A7-84F679B7
Notifies each time the active power scheme personality changes. All power schemes map to one of these
personalities. The Data member is a GUID that
indicates the new active power scheme personality.
- GUID_MIN_POWER_SAVINGS - 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
High Performance - The scheme is designed to deliver maximum performance at the expense of power
consumption savings.
- GUID_MAX_POWER_SAVINGS a1841308-3541-4fab-bc81-f71556f20b4a
Power Saver - The scheme is designed to deliver maximum power consumption savings at the expense of
system performance and responsiveness.
- GUID_TYPICAL_POWER_SAVINGS - 381b4222-f694-41f0-9685-ff5bb260df2e
Automatic - The scheme is designed to automatically balance performance and power consumption
savings.
- GUID_ACDC_POWER_SOURCE - 5d3e9a59-e9D5-4b00-a6bd-ff34ff516548
Notifies each time the system power source changes. The Data member is a
DWORD with values from the
SYSTEM_POWER_CONDITION enumeration that
indicates the current power source.
- PoAc (zero)
The computer is powered by an AC power source (or similar, such as a laptop powered by a 12V automotive
adapter).
- PoDc (one)
The computer is powered by an onboard battery power source.
- PoHot (two)
The computer is powered by a short-term power source such as a UPS device.
- GUID_BATTERY_PERCENTAGE_REMAINING - a7ad8041-b45a-4cae-87a3-eecbb468a9e1
Notifies each time the remaining battery capacity changes. The granularity varies from system to system
but the finest granularity is 1 percent. The Data member is a
DWORD that indicates the current battery capacity remaining, in percentage from 0
through 100.
- GUID_IDLE_BACKGROUND_TASK - 515c31d8-f734-163d-a0fd-11a0-8c91e8f1
The idle/background task notification is delivered when the system is busy. This indicates that the system
will not be moving into an idle state in the near future and that the current time is a good time for
components to perform background or idle tasks that would otherwise prevent the computer from entering an idle
state. There is no notification when the system is able to move into an idle state. The background idle task
notification does not indicate if a user is present or not the computer. The Data
member has no information and can be ignored.
- GUID_SYSTEM_AWAYMODE - 98a7f580-01f7-48aa-9c0f-44352c29e5C0
The away mode notification indicates that the system is entering or exiting away mode. The
Data member is a DWORD that indicates the current away
mode state.
- 0x0
The computer is exiting away mode.
- 0x1
The computer is entering away mode.
- GUID_MONITOR_POWER_ON - 02731015-4510-4526-99e6-e5a17ebd1aea
The monitor on/off notification indicates when the primary system monitor is on or off. This notification
is useful for components that actively render content to the display device, such as media visualization. These
applications should register for this notification and stop rendering graphics content when the monitor is off
to reduce system power consumption. The Data member is a
DWORD that indicates the current monitor state.
- 0x0
The monitor is off.
- 0x1
The monitor is on.
Send comments about this topic to Microsoft
Build date: 10/8/2009