是否可以使用c#检测用户监视器是否已打开?
SP
我也发现这篇文章很有帮助
http://www.netframeworkdev.com/net-base-class-library/msmonitorclass-2114.shtml
cod*_*zen 18
WMI可能有所帮助.
在Vista +中,有WmiMonitorBasicDisplayParams类,其中"Active"属性告诉您显示是否处于活动状态.
这是一个适合我的例子:
using System.Management;
// ...
var query = "select * from WmiMonitorBasicDisplayParams";
using(var wmiSearcher = new ManagementObjectSearcher("\\root\\wmi", query))
{
var results = wmiSearcher.Get();
foreach (ManagementObject wmiObj in results)
{
// get the "Active" property and cast to a boolean, which should
// tell us if the display is active. I've interpreted this to mean "on"
var active = (Boolean)wmiObj["Active"];
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8131 次 |
| 最近记录: |