如何在空闲定时器关闭后使用 .NET 将显示器重新打开?

发布于 2024-08-05 01:17:30 字数 101 浏览 4 评论 0原文

空闲计时器关闭后如何重新打开显示器? 我将 Windows 7 中的电源选项设置为:
1 分钟后关闭显示器
去睡觉:从不但

我不知道如何通过代码重新打开它。

How do I turn the monitor back on after the idle timer has turned it off?
I have power options in windows 7 set to:
Turn off monitor after: 1 minute
Go to sleep: Never

But I don't know how to turn it back on through code.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

自在安然 2024-08-12 01:17:30

这看起来很有希望:http://www.codeproject.com/KB/cs/Monitor_management_guide。 aspx

它使用“SendMessage”API调用:

SC_MONITORPOWER 设置
展示。该命令支持设备
具有省电功能,例如
作为电池供电的个人
电脑。 lParam参数可以
具有以下值:

-1 - 显示器正在开机

1 - 显示器将进入低功耗

2 - 显示屏正在关闭

This looks promising: http://www.codeproject.com/KB/cs/Monitor_management_guide.aspx

It uses the"SendMessage" API call:

SC_MONITORPOWER Sets the state of the
display. This command supports devices
that have power-saving features, such
as a battery-powered personal
computer. The lParam parameter can
have the following values:

-1 - the display is powering on

1 - the display is going to low power

2 - the display is being shut off

梦魇绽荼蘼 2024-08-12 01:17:30

您需要打开它,还是只是阻止它关闭?如果是后者,您可以使用 WinAPI:

SetThreadExecutionState(ES_DISPLAY_REQUIRED)

我不认为有内置的 .net 包装器,但您应该能够 pInvoke 它。

Do you need to turn it on, or just prevent it from turning off? If the latter, you can use the WinAPI:

SetThreadExecutionState(ES_DISPLAY_REQUIRED)

I don't think that there is a .net wrapper built in, but you should be able to pInvoke it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文