void KeepBacklightOn()
{
OSVERSIONINFO osVer = {0};
osVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osVer);
if (osVer.dwMajorVersion <= 5)
{
// Windows CE 5.0, Windows Mobile, or older CE APIs called
SystemIdleTimerReset();
}
else
{
// Windows CE 6.0 uses event
stdString strActivityEventName = Registry::GetValue(_T("HKEY_LOCAL_MACHINE\\System\\GWE"), _T("ActivityEvent"), _T(""));
if (strActivityEventName.empty())
{
MIDLog(MID_ERR, _T("MIDTransSyncGuardDlg::KeepBacklightOn Registry::GetValue ActivityEvent==empty"));
return;
}
HANDLE hActivityEvent = CreateEvent(NULL, FALSE, FALSE, strActivityEventName.c_str());
if (NULL == hActivityEvent)
{
MIDLog(MID_ERR, _T("MIDTransSyncGuardDlg::KeepBacklightOn CreateEvent Error:0x%x"), GetLastError());
return;
}
// Signal user activity to the GWE and Backlight driver
SetEvent(hActivityEvent);
CloseHandle(hActivityEvent);
}
}
{
OSVERSIONINFO osVer = {0};
osVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osVer);
if (osVer.dwMajorVersion <= 5)
{
// Windows CE 5.0, Windows Mobile, or older CE APIs called
SystemIdleTimerReset();
}
else
{
// Windows CE 6.0 uses event
stdString strActivityEventName = Registry::GetValue(_T("HKEY_LOCAL_MACHINE\\System\\GWE"), _T("ActivityEvent"), _T(""));
if (strActivityEventName.empty())
{
MIDLog(MID_ERR, _T("MIDTransSyncGuardDlg::KeepBacklightOn Registry::GetValue ActivityEvent==empty"));
return;
}
HANDLE hActivityEvent = CreateEvent(NULL, FALSE, FALSE, strActivityEventName.c_str());
if (NULL == hActivityEvent)
{
MIDLog(MID_ERR, _T("MIDTransSyncGuardDlg::KeepBacklightOn CreateEvent Error:0x%x"), GetLastError());
return;
}
// Signal user activity to the GWE and Backlight driver
SetEvent(hActivityEvent);
CloseHandle(hActivityEvent);
}
}