如何禁止PDA休眠

7zkeeper 2004-12-24 02:33:24
如何用代码控制禁止PDA休眠
...全文
317 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
无聊客 2004-12-29
  • 打赏
  • 举报
回复
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Power

Value Name Description
BattPowerOff
The number of seconds Windows CE waits for user input while on battery power before initiating a suspend.
ExtPowerOff
The number of seconds Windows CE waits for user input while on external power before initiating a suspend.
WakeupPowerOff
The number of seconds Windows CE waits for user input after an event (such as an alarm) triggers a resume before initiating a suspend, regardless of battery or external power.

Any or all of these values can be set to zero to disable idle suspends under the associated conditions.

你可以试试在先把值置成0,再在置完后再调用一次SystemIdleTimerReset看看效果如何,在家里,没有机器试,不知道行不行,不过这样修改系统键值,感觉也不是很合适,不过用完改回来就可以了
7zkeeper 2004-12-29
  • 打赏
  • 举报
回复
开timer其实是效率最低的做法,如果应用能在计算机休眠之前受到消息,这时候调用这样应该是效率最高的

因为休眠的时间长短取决于用户设定,1而你无法很方便的获取(虽然可以通过读注册表).....
1小时后休眠,启动一个1分钟的定时器显然不妥,所以这是实在没办法的办法,最后考虑
7zkeeper 2004-12-28
  • 打赏
  • 举报
回复
SystemIdleTimerReset没有公开的api?
7zkeeper 2004-12-28
  • 打赏
  • 举报
回复
SystemParametersInfo不行,我用过的
无聊客 2004-12-28
  • 打赏
  • 举报
回复
你只要开一个TIMER就行了,time out你根据需要设置一下,几百毫秒就行了
7zkeeper 2004-12-28
  • 打赏
  • 举报
回复
SystemIdleTimerReset要在休眠之前调用,我如何确定这个位置呢
diaojie 2004-12-27
  • 打赏
  • 举报
回复
建议楼主参考一下这个函数:SystemParametersInfo,相信对你的问题会有所帮助:)
7zkeeper 2004-12-27
  • 打赏
  • 举报
回复
up
无聊客 2004-12-27
  • 打赏
  • 举报
回复
This function resets a system timer that controls whether or not the device will automatically go into a suspended state.

void WINAPI SystemIdleTimerReset(void);
Parameters
None.

Return Values
None.

Remarks
The default behavior is to go into a suspended state after a specified period of time expires. This time interval is specified in the registry. Calling SystemIdleTimerReset overrides the registry setting by resetting the timer.

If the Power Manager is managing timeouts, calls to SystemIdleTimerReset will still reset the GWES timeout and cause the screen saver to stop showing.

This function must be use appropriately. On battery powered devices, a program that never suspends (or sleeps) by continually calling SystemIdleTimerReset can quickly drain the batteries.

The frequency in which to call SystemIdleTimerReset in order to keep a device awake can be determined retrieving the following registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power

无聊客 2004-12-27
  • 打赏
  • 举报
回复
开一个TIMER,在TIMER里调用SystemIdleTimerReset

19,500

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 嵌入开发(WinCE)
社区管理员
  • 嵌入开发(WinCE)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧