gpt4 book ai didi

windows - SetThreadExecutionState 防止手动休眠

转载 作者:可可西里 更新时间:2023-11-01 13:54:42 25 4
gpt4 key购买 nike

在 Windows 7 上,我看到使用参数 ES_CONTINUOUS | 调用 SetThreadExecutionState ES_SYSTEM_REQUIRED | ES_AWAYMODE_REQUIRED 阻止用户手动让系统进入休眠状态。

打开“开始”菜单并选择“ sleep ”后,显示屏关闭,但我的应用程序继续处理。风扇继续全速运行这一事实证明了这一点,并且在唤醒计算机时,我可以看到 sleep 发生时正在执行的操作已经取得进展。

如何让用户在 SetThreadExecutionState 生效时手动让他们的计算机进入休眠状态?

最佳答案

包含 ES_AWAYMODE_REQUIRED 选项会导致此问题。引用自 MSDN 文章:

The ES_AWAYMODE_REQUIRED value should be used only when absolutely necessary by media applications that require the system to perform background tasks such as recording television content or streaming media to other devices while the system appears to be sleeping. Applications that do not require critical background processing or that run on portable computers should not enable away mode because it prevents the system from conserving power by entering true sleep.

关于windows - SetThreadExecutionState 防止手动休眠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21487960/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com