PowerPolicyNotify
A version of this page is also available for
4/8/2010
This function notifies Power Manager of the events required for implementing a power policy created by an OEM.
Syntax
BOOL PowerPolicyNotify(
DWORD dwMessage,
DWORD dwData
);
Parameters
dwMessage
[in] Set to one of the predefined PPN_* values, or a custom value. The following table shows the possible values for dwMessage and the corresponding values for dwData.dwMessage Value dwData PPN_REEVALUATESTATE
0x0001
Reserved. Set dwData to zero.
PPN_POWERCHANGE
0x0002
Reserved. Set dwData to zero.
PPN_UNATTENDEDMODE
0x0003
Set dwData to TRUE or FALSE.
PPN_SUSPENDKEYPRESSED
- or -
PPN_POWERBUTTONPRESSED
0x0004
Reserved. Set dwData to zero.
PPN_SUSPENDKEYRELEASED
0x0005
Reserved. Set dwData to zero.
PPN_APPBUTTONPRESSED
0x0006
Reserved. Set dwData to zero.
PPN_OEMBASE
Greater than or equal to 0x10000.
You can define higher values, such as 0x10001, 0x10002, and so on.
Reserved. Set dwData to zero.
These values are only revelant for OEM-modified power management.
- dwData
[in] 32-bit value that varies depending on the dwMessage value.
Return Value
TRUE indicates success.
FALSE indicates failure.
Remarks
PowerPolicyNotify should be called in the keyboard/keypad driver.
When PowerPolicyNotify is called, it causes a thread internal to Power Manager to call into Power Manager platform device driver (PDD). To force a power condition, you may need to configure the priority of this internal thread. Configure the priority of this thread in the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\SystemPriority256 registry key. For information about the default values of device driver threads, see Real-Time Priority System Levels.
Rather than using a key event to notify the system of a power or application button press, on Windows Mobile Professional and Windows Mobile Classic devices you must use PPN_POWERBUTTONPRESSED and PPN_APPBUTTONPRESSED to notify the system. When the power button is pressed, you do not need to send any virtual-key codes for the power button. When an application button is pressed, the keyboard driver must send the appropriate virtual-key code, but if the keyboard driver also calls PowerPolicyNotify, Power Manager manages the power to the screen and the backlight.
PPN_UNATTENDEDMODE is used only on Windows Mobile Professional and Windows Mobile Classic devices, but not on Windows Mobile Standard or general embedded devices. Unattended mode tells the system that your code is running something that the user does not need to see, for example, synchronizing in the background. Call PowerPolicyNotify(PPN_UNATTENDEDMODE, TRUE) to get into unattended mode and PowerPolicyNotify(PPN_UNATTENDEDMODE, FALSE) to get out. This is a special state that is different than most. You can call it from any current state, but it only goes into that state in special cases. If the system is currently in Resuming state, it goes into the Unattended state. Otherwise, it stays in the current state and increments a reference count on Unattended. If the user presses the power button and the unattended reference count is greater than zero, the system goes into Unattended state, rather than Suspended state. Default levels are the same as for the On state. with the exception of LCD and audio, which are both in D4.
PPN_UNATTENDEDMODE sends a message to Power Manager, requesting a change into Unattended mode.