Answer

专注于Mobile,WinCE
  首页  :: 新随笔  :: 联系 :: 管理

mobile,ppc,wince防止自动挂起

Posted on 2008-07-03 18:21  answer  阅读(863)  评论(0编辑  收藏  举报

为了省电,Mobile,PPC,WinCE等PDA会在系统闲置一段时间后,会自动作挂起的动作。
为防止机器做自动挂起的动作,可以注册表修改如下:

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Power\Timeouts]
"BattSuspendTimeout"=dword:00000000


这里需要注意的是,修改了此注册表选项后,系统不会马上起作用。需要对机器作一次 Warm boot 的动作。

如果不想做 Warm boot 的动作,那么需要用如下的代码去更新:

// Tell power manager to reload the registry timeouts
HANDLE hevReloadActivityTimeouts =
    OpenEvent(EVENT_ALL_ACCESS, FALSE, _T("PowerManager/ReloadActivityTimeouts"));
if (hevReloadActivityTimeouts)
{
    SetEvent(hevReloadActivityTimeouts);
    CloseHandle(hevReloadActivityTimeouts);
}