gpt4 book ai didi

c++ - 如何在程序执行期间防止屏幕保护程序和 sleep ?

转载 作者:IT老高 更新时间:2023-10-28 23:10:29 25 4
gpt4 key购买 nike

在 Win7 上运行的 c++ 程序中,有没有办法伪造鼠标移动或类似的东西,只是为了防止屏幕保护程序启动和系统进入休眠状态?我正在寻找最小的方法,我不喜欢使用 .NET。谢谢,-nuun

最佳答案

不要乱用屏保设置,使用SetThreadExecutionState .这是用于通知窗口您的应用程序处于事件状态的 API:

Enables an application to inform the system that it is in use, thereby preventing the system from entering sleep or turning off the display while the application is running.

,和

Multimedia applications, such as video players and presentation applications, must use ES_DISPLAY_REQUIRED when they display video for long periods of time without user input

关于c++ - 如何在程序执行期间防止屏幕保护程序和 sleep ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3665332/

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