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#
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#
The SDK docs has a how-to on this here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mobilesdk5/html/mob5tskHowToProgramApplicationsToTurnSmartphoneBacklightOffOn.asp
A managed sample can be found here:
http://www.peterfoot.net/KeepYourSmartphoneBacklightOn.aspx
http://www.peterfoot.net/TimeToTurnOutTheLights.aspx
Michael
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
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.
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.