如何检索显示器信息?
我正在尝试检索 Windows 显示属性中所示的显示器 ID(#1、2...等),但我似乎找不到方法。我尝试过使用EnumDisplayMonitors以及EnumDisplayDevices。它们都返回类似“\.\DISPLAY1”的内容。然而,这个数字并不总是与 Windows 显示的数字相匹配,特别是当使用 2 个视频卡驱动 3 个或更多显示器时。我是否缺少一个 API 调用来检索此信息,或者有没有办法从注册表或其他地方获取它?谢谢!
我尝试过这些方法:
Win32: EnumDisplayMonitors、EnumDisplayDevices:这两个监视器都不会返回不活动的监视器,也不会返回正确的 ID。
WMI:“select * from Win32_DesktopMonitor”不会返回所有监视器,并且没有 ID。
注册表:我在不同位置找到了监视器,但我找到的所有位置都没有我要查找的信息。
非常感谢任何帮助。 :)
更新:这些是我正在寻找的显示器编号:
I am trying to retrieve the monitor ID's as shown in the Windows display properties (#1, 2... etc), but I can't seem to find a way. I have tried using EnumDisplayMonitors as well as EnumDisplayDevices. They both return something like "\.\DISPLAY1". However, this number doesn't always match the number shown by Windows, especially when 2 video cards are being used to drive 3 or more monitors. Is there an API call I am missing to retrieve this information, or is there a way to get it from the registry or somewhere else? Thanks!
I have tried these methods:
Win32: EnumDisplayMonitors, EnumDisplayDevices: Neither of these return monitors that aren't active, and neither one returns the correct IDs.
WMI: "select * from Win32_DesktopMonitor" doesn't return all the monitors, and there is no ID.
Registry: I have found the monitors in various locations, none of the places I found have the info I am looking for.
Any help is much appreciated. :)
Update: These are the monitor numbers I am looking for:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根据目的,您可能希望寻求基于驱动程序的解决方案。我知道 nVidia 有一些不错的库,可以让您访问控制面板上的大部分功能。
Depending on the purpose, you might want to look toward a driver-based solution. I know nVidia have some decent libs that gives you access to most of the functions un the control pannel.
您是否对 EnumDisplayDevices 进行了两次调用?尝试类似的方法:
Did you make two calls to EnumDisplayDevices? Try something like:
只是猜测,但 Windows 显示属性中似乎显示了
iDevNum+1
。Just a guess, but it looks like Windows shows
iDevNum+1
in Windows display properties.