How Do I Programmatically Turn Pocket PC or CE. NET Display Backlight On and Off?

Article ID: 23888373

Question

How Do I Programmatically Turn Pocket PC or CE. NET Display Backlight On and Off?

Facts

Pocket PC and CE .NET Devices

Answer

There may be instances where the user may need to programmatically turn the display backlight of a Pocket PC or CE .NET device on and off.

Use the code below to programmatically turn the display backlight on and off:
 

CEDEVICE_POWER_STATE DeviceStateOn = {D0};

CEDEVICE_POWER_STATE DeviceStateSleep = {D3};

CEDEVICE_POWER_STATE DeviceStateOff = {D4};

void BacklightOn( void )

{

    CEDEVICE_POWER_STATE CurrentState = DeviceStateOff;

    GetDevicePower( TEXT("BKL1:"), POWER_NAME, &CurrentState );

    if ( CurrentState != DeviceStateOn )

           DevicePowerNotify( TEXT("BKL1:"), DeviceStateOn, POWER_NAME );

}

void BacklightOff( void )

{

    CEDEVICE_POWER_STATE CurrentState = DeviceStateOff;

    GetDevicePower( TEXT("BKL1:"), POWER_NAME, &CurrentState );

    if ( CurrentState != DeviceStateOff )

           DevicePowerNotify( TEXT("BKL1:"), DeviceStateOff, POWER_NAME );

}

void BacklightSleep( void )

{

    CEDEVICE_POWER_STATE CurrentState = DeviceStateOff;

    GetDevicePower( TEXT("BKL1:"), POWER_NAME, &CurrentState );

    if ( CurrentState != DeviceStateSleep )

           DevicePowerNotify( TEXT("BKL1:"), DeviceStateSleep, POWER_NAME );

 

  • }

#include<Pm.h>