• Announcements

    • Reminder - MoDaCo position on illegal content   07/30/15

      ILLEGAL CONTENT I'd like to just reaffirm MoDaCo's position regarding piracy and illegal content in the light of some recent questions / postings. Posts will be censored by myself or my moderation team if the contain or link to: Illegal / pirated / cracked software or sites that host such softwareNintendo emulators / ROMs or sites hosting them (in light of Nintendo's legal stance)CUSTOM ROMS You may discuss and post links to custom device ROMs on MoDaCo, provided the following rules are adhered to: ROMs must not contain any illegal 3rd party software (this includes trial versions included without permission)ROMs must give full credit to the original authorISSUES If you have any issues with this policy, please contact PaulOBrien directly via PM.
    • Reminder: Selling items on the forum directly is not allowed   07/30/15

      Please note that selling items on the forum directly is not allowed by the forum rules. There is a forum for eBay auctions whereby you can list the items on eBay and link to them there. This is the ONLY forum for this type of activity. You may also advertise links to the eBay forum in your signature. Please note that selling directly in contravention of these rules will result in a warning / suspension / ban.

Keep the backlight on :D

21 posts in this topic

Posted

Hi all

A HUGE thanks to my contact at O for his help with this :P

This is one that people should find useful (I know I will).

(note : only appears to work on the SPV, E100 & E200 Smartphones - not the others)

As most of you will know, whilst an app is running if you don't press a key for a while the backlight timer kicks in and the screen dims, eventually dimming to off - or alternately the Home Page timeout kicks in and the phone returns to the home page.

If you want to keep the backlight completely on in an app AND stop the timeout to the homescreen altogether (very useful for games),

first include these 2 headers:-

#include "windows.h"

#include "tpcshell.h"[/code] then create a global variable :-
[code]DWORD lastTimerReset;
and then in your main app/game loop add this code :-
// every 9 seconds 

if(GetTickCount() - lastTimerReset> 9000)

{

// this keeps the backlight on, but only on spv, e100, e200

#define   EVENT_DISPLAYOFF TEXT("TIMEOUTDISPLAYOFF")



HANDLE g_hDispEvent = CreateEvent(NULL, FALSE, FALSE, EVENT_DISPLAYOFF);

SetEvent(g_hDispEvent); //LCD frontlight on



::SHIdleTimerReset();

lastTimerReset = GetTickCount();

}[/code]

Basically every 9 seconds the code is run to stop the timers kicking in - why 9 seconds? I hear you cry. Well the lowest standard setting on backlight or home page timers is 10 seconds, so resetting them every 9 will do :)

happy coding,

muff

0

Share this post


Link to post
Share on other sites

Posted

Nice :)

P

0

Share this post


Link to post
Share on other sites

Posted

Anyone know a solution that works on the C500 (Smartphone OS 2003 SE)?

I've been trying to use both:

SystemIdleTimerReset

SHIdleTimerReset

...but they don't work. They stop the home screen from kicking in...but they don't stop the backlight from dimming. Unfortunately a bug in GAPI causes games to freeze when the backlight dims :)

0

Share this post


Link to post
Share on other sites

Posted

I'll be posting up a C500 version soon now, I'm just working on some other stuff, and then I'll be fully testing then C500 fix before a post

0

Share this post


Link to post
Share on other sites

Posted

as promised, C500 code

header include at the top

#include "pm.h"
at the start of the winmain function
HANDLE hPower;  

hPower = SetPowerRequirement(TEXT("BKL1:"), D0, POWER_NAME, NULL, 0);[/code] and on the way out of the winmain function (so it's called as the app closes)
[code]ReleasePowerRequirement(hPower);

and that's about it really

I personally use it in conjunction with the previous code so that the backlight stays on, and neither 2k2 or 2k3 drop out to homescreens

of course the 2k3 code is partitioned to only be included in the 2k3 build - the PowerRequirement functions are only usable on 2k3 systems

one thing you should be aware of with using this code, is that if the app/game loses focus for any reason (incoming call for example) , the backlight will remain on until you close that app/game

I've tried doing the release and then restating it when losing / gaining focus, but that didn't appear to work for me

happy coding

muff

0

Share this post


Link to post
Share on other sites

Posted

I can confirm that the code posted by Muff works on C500!! Fantastic!

I'd tried it before Muff posted his solution but stupidly I forgot to put the TEXT macro around the "BKL1:". D'oh!!!

One thing I would suggest is for people who want to write code that works on both SP 2002 and SP 2003....use GetProcAddress instead of #include

// Copied from pm.h


typedef enum _CEDEVICE_POWER_STATE {


    PwrDeviceUnspecified = -1,


    D0 = 0, // Full On: full power,  full functionality


    D1,     // Low Power On: fully functional at low power/performance


    D2,     // Standby: partially powered with automatic wake


    D3,     // Sleep: partially powered with device initiated wake


    D4,     // Off: unpowered


    PwrDeviceMaximum


} CEDEVICE_POWER_STATE, *PCEDEVICE_POWER_STATE;




#define POWER_NAME (DWORD)(0x00000001)


#define POWER_FORCE (DWORD)(0x00001000)




typedef DWORD (*RELEASEPOWERREQUIREMENT)( 


   HANDLE hPowerReq );


typedef HANDLE (*SETPOWERREQUIREMENT)(


   PVOID pvDevice,


   CEDEVICE_POWER_STATE DeviceState,	


   ULONG DeviceFlags,


   PVOID pvSystemState,


   ULONG StateFlags );
At application startup...
HANDLE HdlPower = NULL;


HINSTANCE HdlCoreDll = LoadLibrary( TEXT("coredll.dll") );


if ( HdlCoreDll )


{


   SETPOWERREQUIREMENT PtrFunc = (SETPOWERREQUIREMENT)GetProcAddress( HdlCoreDll, TEXT("SetPowerRequirement") );


   if ( PtrFunc )


   {  


      HdlPower = (*PtrFunc)(TEXT("BKL1:"), D0, POWER_NAME, NULL, 0);


   }


   FreeLibrary( HdlCoreDll );


}
At application shutdown...
HINSTANCE HdlCoreDll = LoadLibrary( TEXT("coredll.dll") );


if ( HdlCoreDll )


{


   RELEASEPOWERREQUIREMENT PtrFunc = (RELEASEPOWERREQUIREMENT)GetProcAddress( HdlCoreDll, TEXT("ReleasePowerRequirement") );


   if ( PtrFunc )


   {  


      (*PtrFunc)( HdlPower );


   }


   FreeLibrary( HdlCoreDll );


}

0

Share this post


Link to post
Share on other sites

Posted

Does anyone know how to stop backlight dimming on PocketPC 2002?

I presume the SetPowerRequirement will work on PocketPC 2003....however, I haven't yet tested it.

0

Share this post


Link to post
Share on other sites

Posted

Does anyone know how to stop backlight dimming on PocketPC 2002?

I presume the SetPowerRequirement will work on PocketPC 2003....however, I haven't yet tested it.

yup this does indeed work on the PPC :lol: (well it does on the m1000 anyway)

dont think it stops the actual power off timer of the device, but that's probably not too bad a thing, can't imagine just leaving something running in battery mode anyway

thanks for your variation on the c500 code above as well - now you can compile for 2k2 and still get the benefit of the power work around on 2k3 phones

2k2 compiled code tends to run slightly faster than a 2k3 compile of the code for some reason - so the fact that we can have 2k2 compile with the backlight code workaround is great news :lol:

(also nice to see someone else sharing code :))

0

Share this post


Link to post
Share on other sites

Posted

ReleasePowerRequirement doesn't seem to work for me on the C500...

P

0

Share this post


Link to post
Share on other sites

Posted

"]ReleasePowerRequirement doesn't seem to work for me on the C500...

P

yeah, not really convinced that the command works properly on the C500

certainly in testing minimising an app, with a ReleasePowerRequirement on the WM_KILLFOCUS didn't appear to do anything :/

maybe this is to do with the way the C500 handles it's power functions?

0

Share this post


Link to post
Share on other sites

Posted

Any update on that issue on c500 ???

I have implemented the first part (SPV 1G) with success, thx muff, but I am awaiting a new device ^_^ and would like to find a way on c500 ..

thanks guys,

Phil.

0

Share this post


Link to post
Share on other sites

Posted

Any update on that issue on c500 ???

I have implemented the first part (SPV 1G) with success, thx muff, but I am awaiting a new device ^_^ and would like to find a way on c500 ..

thanks guys,

Phil.

erm, the c500 code is also above :D

0

Share this post


Link to post
Share on other sites

Posted

Hi Muff,

Sorry if I misunderstood the posts (being french, that helps ^_^), but I thought Paul and yourself were saying the code you posted for C500 didn't actually work ...

Anyway I'll try it myself, better than wasting others' time ...

Thanks a bunch,

Phil

0

Share this post


Link to post
Share on other sites

Posted

Not being a developer myself, does anyone have an actual app containing the code that they can post? It would be great to use when driving in car to keep the backlight on.

It doesn't have to have any user interface, just run it, at it keeps backlight on. And if possible, some mechanism for terminating the app as well, without using a task manager.

THANKS A GAZILLION!!!

Allan Hvass

0

Share this post


Link to post
Share on other sites

Posted

I have an application that I have put in the startup folder and it changes the backlight timeout to never when the SPV is charging, however when you disconnect the charging it goes back to the original setting.

There is no credits on the app and I do not remember where I got it from.

Hope it helps.

AutoBackLight.CAB

0

Share this post


Link to post
Share on other sites

Posted

mmmmm,

Wonder if you could use the code above as a wrapper for your apps??

call your wrapper - this calls the app you want to run, and when you quit it - runs the final part to turn it off again

I will see if I get some time to have a play..

Rik

0

Share this post


Link to post
Share on other sites

Posted

To Gazzaw: Yeah, I've already tried that app (and several others, incl. the Orneta ones), and they work as advertise, i.e. they DO change the backlight timeout setting to Never while running, problem is, that on models prior to the SPVe200, the phone simply doesn't respect that, it turns off backlight still (sometimes it works correctly when using a charger, but not consistently, and never when running off battery or in a car kit).

Since several in this thread have tested the code, they must have some kind of prototype, that could easily be adjusted to a selfcontained app.

The wrapper thing that rikwebb suggests would be ideal for the application I have in mind (Mapopolis), since that's exactly what I want to achieve. A wrapper where you could parameterize (even just through a registry setting) the app to call would make it very generic. Except if you just want your phone to stay lit e.g. while in a car kit, withour running any particular app.

I would be hugely thankful for such an app. Bow in the dust, etc. - you get the picture :wink:

0

Share this post


Link to post
Share on other sites

Posted

I've no idea how but my backlight has decided to stay permanently on. I've not input any codes or anything, how do I turn it off?

0

Share this post


Link to post
Share on other sites

Posted

if i sound simple all appologise, but im new to this. only had my C500 3 weeks. so where exactly do you put this code in the phone and what do you write it in to be able to put it in the phone?

hawko [-o<

0

Share this post


Link to post
Share on other sites

Posted

if i sound simple all appologise, but im new to this. only had my C500 3 weeks. so where exactly do you put this code in the phone and what do you write it in to be able to put it in the phone?

hawko [-o<

<{POST_SNAPBACK}>

http://www.modaco.com/index.php?showtopic=199025

0

Share this post


Link to post
Share on other sites

Posted

I've found a way to keep the backlight on and the machine from sleeping which seems to work on all versions of Windows desktop and mobile.

Every 9 seconds (as suggested above), do the following:

keybd_event(VK_F24, 0, KEYEVENTF_KEYUP, 0);

This creates a "virtual" keypress (actually a key release) of a non-existant key and fools the system into thinking that the user is doing it.

Seems to work fine on all devices I've tested.

Larry B.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

MoDaCo is part of the MoDaCo.network, © Paul O'Brien 2002-2015. MoDaCo uses IntelliTxt technology.