向用户禁用屏幕保护程序
我想禁用另一个用户的屏幕保护程序。怎样才能做到呢?
我有管理权限。我有一个不能被屏幕保护程序中断的应用程序。
I want to disable a screen saver to another user. How it can be done?
I have administrative privileges. I have an application that can't be interrupted by the screen saver.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您自己编写应用程序,请考虑调用非托管 API SetThreadExecutionState (PInvoke 参考< /a>)。从我的答案复制到 我该怎么办在程序执行期间阻止屏幕保护程序和睡眠?:
不要弄乱屏幕保护程序设置,请使用 SetThreadExecutionState。这是用于通知 Windows 您的应用程序处于活动状态这一事实的 API:
, 和
如果您无法控制应用程序,但屏幕保护程序启动会导致问题,则将此信息推送回开发人员。
禁用屏幕保护程序几乎总是是错误的解决方案,因为它会影响用户的整个体验,而不仅仅是在应用程序运行时。
If you're writing the application yourself, look into calling the unmanaged API SetThreadExecutionState (PInvoke reference). Copying from my answer to how do i prevent screen-savers and sleeps during my program execution?:
Don't mess with the screensaver settings, use SetThreadExecutionState. This is the API for informing windows on the fact that your application is active:
, and
If you don't have control over the application, but the screen saver kicking in causes problems, then push this information back to the developers.
Disabling the screensaver is almost always the wrong solution to the problem, since it affects the users whole experience, not just when the application is running.
用 C# 控制屏幕保护程序
KillScreenSaver( )
Controlling The Screen Saver With C#
KillScreenSaver( )