Preventing the backlight from turning off in CE 6.0

So it seems that something has changed in CE 6.0 in the way that user inactivity is detected by the OS.  In CE 5.0 and before, if we wanted to keep the backlight on we could periodically call SystemIdleTimerReset and all would be well.  In CE 6.0, this no longer works.  Now we have to set a named event that GWE is waiting on.  Here’s what it looks like (this code uses the SDF for the named EventWaitHandle – the CF doesn’t provide one).

private EventWaitHandle m_activityEvent;

[DllImport(“coredll”, SetLastError=true)]
private static extern void SystemIdleTimerReset();

private void ResetBacklightTimer()
  if (Environment.OSVersion.Version.Major <= 5)
    if (m_activityEvent == null)
      using (var key = Registry.LocalMachine.OpenSubKey(“System\GWE”))
        object value = key.GetValue(“ActivityEvent”);
        if (value == null) return;

        string activityEventName = (string)value;
        m_activityEvent = new EventWaitHandle(false, EventResetMode.AutoReset, activityEventName);


3 thoughts on “Preventing the backlight from turning off in CE 6.0”

  1. On my HTC Diamond with Windows Mobile 6.1 the registry value is "PowerManager/ActivityTimer/UserActivity".
    I created the event and made it signaled (SetEvent). The device goes to sleep.
    Something wrong on my side?


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s