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)
{
SystemIdleTimerReset();
}
else
{
if (m_activityEvent == null)
{
using (var key = Registry.LocalMachine.OpenSubKey("System\\GWE"))
{
object value = key.GetValue("ActivityEvent");
key.Close();
if (value == null) return;
string activityEventName = (string)value;
m_activityEvent = new EventWaitHandle(false, EventResetMode.AutoReset, activityEventName);
}
}
m_activityEvent.Set();
}
}