确定连接哪些监视器/显示器/屏幕
在 Windows 桌面属性中,所有显示都会显示并指示为活动或非活动。我的显卡有一个显示器连接到 dvi 端口,但没有连接到 vga,并且这是正确确定的(即其中一个显示器被标记为非活动)。我还有一个 USB DisplayLink 液晶显示器,也被检测到。
使用 system.windows.forms.screen.allscreens 我能够枚举系统上所有可能的显示器(在本例中为 3 个),但我无法确定哪些显示器处于活动状态(即实际上有设备连接到它们)。这在.net中可能吗?
system.windows.forms.screen 的属性似乎都没有此信息。
编辑:注意到我的问题实际上是这个问题,但我是在 Hans Passant 指示我查看 WMI 后才发现的。
In the windows desktop properties all the displays are shown and are indicated to be active or inactive. My graphics card has a monitor connected to the dvi port but not the vga and this is correctly determined (i.e. one of the displays is labelled inactive). I also have a usb displaylink lcd which is also detected.
Using system.windows.forms.screen.allscreens I am able to enumerate all the possible displays (in this case, 3) on my system but I am unable to determine which ones are active (i.e. actually have a device connected to them). Is this possible in .net?
None of the properties of system.windows.forms.screen seem to have this information.
EDIT: Noted that my question is actually a duplicate of this question but I only found it after Hans Passant directed me to looking at WMI.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,它看不到禁用的屏幕。您必须使用低级硬件查询,即 WMI 和 System.Management 类支持的类型。我猜测是 Win32_VideoController,可用性成员。使用 WMI 代码创建工具 尝试查询并获取您想要在程序中使用的代码。
No, it cannot see disabled screens. You'd have to use a low-level hardware query, the kind that are supported by WMI and the System.Management class. I'd guess at Win32_VideoController, Availability member. Use the WMI Code Creator tool to experiment with the query and get the code you want to use in your program.