以编程方式中断活动的屏幕保护程序? [英] Interrupt an active screensaver programmatically?

查看:63
本文介绍了以编程方式中断活动的屏幕保护程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

原因:我正在开发一个紧急警报应用程序,该应用程序需要在桌面上显示信息.当客户端收到警报时,它会弹出一个窗口.如果屏幕保护程序处于活动状态或显示器处于待机状态,则不会显示警报.我想知道是否可以通过某种程序化的鼠标移动或系统调用将计算机唤醒,从而使警报可见.我认为鼠标移动或按键唤醒它的原因是由于硬件中断,因此可能无法实现.

REASON: I'm working on an emergency alert application that needs to display information on a desktop. When the client receives an alert, it pops up a window. If a screensaver is active or the monitor is in standby the alert will not be visible. I'm wondering if it's possible to wake the computer up via some sort of programatic mouse move or system call so that the alert would be visible. I think the reason a mouse move or keypress wakes it up is because of a hardware interrupt so it may not be possible.

当前,该项目正在用C#实现.我很想听听有关Windows,MAC和Linux的解决方案.

Currently, the project is being implemented in C#. I'm interested to hear about solutions for Windows, MAC, and Linux.

这是客户的要求.我考虑了以下内容:

This is a customer request. I have considered the following:

  • 在大多数计算机不活动后,用户必须登录.这些计算机将不会收到警报
  • 很有可能,如果屏幕保护程序处于活动状态,那么无论如何都不会有人在计算机旁.

我不是要:

  • 防止同时激活屏幕保护程序或节能模式.

推荐答案

以fbonnet所说的内容为基础,以使用 kb 文章, pinvoke.net 网站是一个很好的资源.他们还在 PostMessage 函数此处.

Building on what fbonnet said, to use the functions shown in the kb article in C# the pinvoke.net site is a great resource. They also have a article on the PostMessage function here.

因此,使代码正常工作的基本方法是搜索 kb pinvoke.net 网站上的文章.或者您可以阅读本文为您完成了此操作./strong>

So the basic way of getting your code working could be searching the functions listed in the kb article on the pinvoke.net site. Or you can read this article has done that for you.

这篇关于以编程方式中断活动的屏幕保护程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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