You can programmatically turn the Windows Mobile powered device's backlight on and off by calling a pair of
Note: |
|---|
| In the context of Power Management, the term "device" refers to a Windows Mobile powered device subsystem, and not a Windows Mobile powered device per se. Examples of devices are Back Light (BKL1), Notification LED (NLD1), Infrared Communications Port (COM3), Camera (CAM1), Subscriber Identity Module (SIM1), BlueTooth (BTL1), and Storage Card (DSK1). For information on the available devices, see the system registry under the key HKEY_LOCAL_MACHINE\Drivers. |
Code Example
The following code example demonstrates how to programmatically set and release the device power requirement to keep the backlight at full power (a
Note: |
|---|
| To make the following code example easier to read, security checking and error handling are not included. This code example should not be used in a release configuration unless it has been modified to include them. |
Copy Code | |
|---|---|
// IN BOOL fBacklightOn - TRUE to keep the backlight on.
void SetBacklightRequirement(BOOL fBacklightOn)
{
// The name of the backlight device.
TCHAR tszBacklightName[] = TEXT("BKL1:");
static HANDLE s_hBacklightReq = NULL;
if (fBacklightOn)
{
if (NULL == s_hBacklightReq)
{
// Turn the backlight on by setting the requirement that the backlight device
// must remain in device state D0 (full power). Replace D0 with D4 (zero power) to
// turn the backlight off.
if (!s_hBacklightReq)
RETAILMSG(1, (L"SetPowerRequirement failed: %X\n", GetLastError()));
}
}
else
{
if (s_hBacklightReq)
{
RETAILMSG(1, (L"ReleasePowerRequirement failed: %X\n", GetLastError()));
s_hBacklightReq = NULL;
}
}
} | |
Remarks
Your application should turn the backlight off as soon as it no longer needs it on.
SDKs for Windows Mobile 6 ship with a sample application called
Requirements
OS Versions: Windows CE .NET 4.0 and later
Header: Pm.h
Library: Coredll.lib
See Also
Concepts
How to: Determine Battery StatusPreventing Automatic Power Down
How to: Suspend the Device
Other Resources
Memory and Power Management
See Also
Note: