问题描述
当您在屏幕分辨率"对话框中按下识别"按钮时,Windows 会在每台显示器上显示大的白色显示器编号.在 Windows XP(使用 EnumDisplayDevices)中以编程方式与监视器坐标一起找到它们很容易,但在 Windows 7 上它坏了.我该怎么做?
When you press Identify button in Screen Resolution dialog then Windows shows you big white monitor numbers on each monitor. It was easy to find them programmatically together with monitor coordinates in Windows XP (with EnumDisplayDevices) but on Windows 7 it's broken. How can I do that?
- EnumDisplayDevices 和 GetMonitorInfo 是 不再可靠为此目的在 Windows 7 中.
- 我尝试了 GetMonitorInfo,然后从 MONITORINFOEX.szDevice (I.E. \.\Display2) 中提取监视器编号,但没有成功.另一个人 两年前也这样做了,并声称 getMonitorInfo 有一个错误.此错误已标记由微软修复,没有任何评论,但它仍然可以在具有最新更新的 win7 机器上复制.(顺便说一句,谁能告诉我 - 也许这个错误在 win8 上不存在?)
- 我尝试了 QueryDisplayConfig 来自新的 CCD API,但没有找到所需的信息.
- EnumDisplayDevices and GetMonitorInfo are not reliable anymore for that purpose in Windows 7.
- I tried GetMonitorInfo and then extracting monitor number from MONITORINFOEX.szDevice (I.E. \.\Display2) with no success. Another guy did that too two years ago and claimed that getMonitorInfo has a bug. This bug was marked as fixed by Microsoft without any comments but it still can be reproduced on a win7 machine having latest updates. (Btw, can anybody tell me - maybe this bug is absent on win8 ?)
- I tried QueryDisplayConfig from new CCD API but didn't find needed info.
有人认识路吗?
推荐答案
Windows 不提供允许应用程序获取显示设置应用程序使用的数字的功能.这些数字本身仅特定于显示设置应用程序,在系统或 CCD API 用于查询/设置显示拓扑.
Windows does not provide a function that allows applications to obtain the numbers used by the display settings app. The numbers themselves are specific only to the display settings app and have no meaning in the system or in the CCD APIs used to query/set the display topology.
最好的选择是让应用程序在提示用户选择显示器时定义自己的索引分配标准.
The best option is for applications to define their own criteria for assigning an index when prompting the user to select a display.
这篇关于如何以编程方式从 win7 的屏幕分辨率对话框中获取显示器编号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!