jac*_*cob 7 c# c++ winapi windows-xp windows-7
如果'windows power management'关闭了显示屏,我如何以编程方式检查Windows 7和XP?(如果我能收到一个活动,那会更好.)
我不认为它可以用于XP.在Windows 7中,有各种与电源管理相关的好东西.在Windows API的代码包是一套托管的包装是简单的从C#或VB和地图的Windows范式(如事件接收器,Windows消息和函数指针)到.NET那些调用(如委托和事件.)由动力代码包附带的管理演示,这里有一些您可能喜欢的代码:
using Microsoft.WindowsAPICodePack.ApplicationServices;
// . . .
PowerManager.IsMonitorOnChanged += new EventHandler(MonitorOnChanged);
// . . .
void MonitorOnChanged(object sender, EventArgs e)
{
settings.MonitorOn = PowerManager.IsMonitorOn;
AddEventMessage(string.Format("Monitor status changed (new status: {0})", PowerManager.IsMonitorOn ? "On" : "Off"));
}
Run Code Online (Sandbox Code Playgroud)
编辑:
Windows API代码包的链接:Windows API代码包:它在哪里?
如果你想使用它就像在这篇文章中提到的那样检查:https://stackoverflow.com/a/27709672/846232
| 归档时间: |
|
| 查看次数: |
6198 次 |
| 最近记录: |