How can i turn on the screen backlight

How can i turn on the screen backlight from my application

fter it was automatically turned off to save power.

I use Windows Mobile 5.0
and writin in C#

[175 byte] By [oferebert] at [2007-12-26]
# 2
One way to keep your PDA alive is to to use the P/Invoke library,

Declare Sub SystemIdleTimerReset Lib "coredll" ()
Declare Sub SHIdleTimerReset Lib "Aygshell.dll" Alias "SHIdleTimerReset" ()

Const POWER_STATE_ON As Integer = &H10000
Const POWER_STATE_OFF As Integer = &H20000
Const POWER_STATE_SUSPEND As Integer = &H200000
Const POWER_FORCE As Integer = 4096
Declare Function SetSystemPowerState Lib "Coredll" ( _
ByVal pwrState As String, _
ByVal pwrStateFlags As Integer, _
ByVal Options As Integer) As Integer

Calling SetSystemPowerState will turn the backlight on.

If KeepAlive = True Then
SetSystemPowerState(Nothing, POWER_STATE_ON, POWER_FORCE)
SystemIdleTimerReset()
SHIdleTimerReset()
End If

crt at 2007-9-4 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...
# 3

Thanks it answer my question but not fully.

There are some cases I need to turn on backlight and than I want the PDA to continue to behave like before, With its time outs

and so on and I did not found out how to do this.

I mean that I need to turn on the light like when the user touches the screen.

oferebert at 2007-9-4 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...
# 4

The MSDN how-to article in my initial answer shows how to do this (here).

To restore the default behavoir:
call the native API ReleasePowerRequirement. (Pass in the handle returned by the previous call to SetPowerRequirement)

To turn the backlight back on: call the native API SetPowerRequirement as shown in the above sample.

MichaelKoster at 2007-9-4 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...