如果正在使用C#运行Windows屏幕保护程序,该如何关闭它? [英] How do I turn off the windows screen saver if it is running using C#?

查看:63
本文介绍了如果正在使用C#运行Windows屏幕保护程序,该如何关闭它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好,所以我找到了一些代码来检查屏幕保护程序是否运行并杀死它,如果我想的话.这似乎不适用于Windows 7 PC.有谁知道如何修改此代码,或提供新代码来实现此目的?

Ok, so I found some code to check if a screensaver is running and kill it if I want to. This doesn't seem to work on Windows 7 PCs. Does anyone know how this code can be modified, or provide new code to accomplish this?

我的应用程序设计为在后台运行,直到发生特定事件为止,然后创建并显示全屏通知.即使屏幕保护程序当前已启动,也需要显示该信息.

My application is designed to run in the background until a particular event occurs, and then create and display a full screen notification. This needs to be displayed even if a screen saver is currently up.

推荐答案

最简单的方法是通过调用SendInput()来伪造x = y = 0的鼠标移动事件.

The easiest way is to fake a mouse move event with x=y=0 by calling SendInput().

这篇关于如果正在使用C#运行Windows屏幕保护程序,该如何关闭它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆