如何以编程方式从 win7 中的屏幕分辨率对话框获取显示器编号? [英] How can I get monitors numbers from Screen Resolution dialog in win7 programmatically?

查看:11
本文介绍了如何以编程方式从 win7 中的屏幕分辨率对话框获取显示器编号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您在屏幕分辨率"对话框中按下识别"按钮时,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?

  1. EnumDisplayDevices 和 GetMonitorInfo 是 不再可靠在 Windows 7 中用于此目的.
  2. 我尝试了 GetMonitorInfo,然后从 MONITORINFOEX.szDevice (I.E. .Display2) 中提取监视器编号,但没有成功.另一个人 两年前也这样做了,并声称 getMonitorInfo 有一个错误.此错误已标记由微软修复,没有任何评论,但它仍然可以在具有最新更新的 win7 机器上复制.(顺便说一句,谁能告诉我 - 也许这个错误在 win8 上不存在?)
  3. 我试过 QueryDisplayConfig 来自新的 CCD API,但没有找到需要的信息.
  1. EnumDisplayDevices and GetMonitorInfo are not reliable anymore for that purpose in Windows 7.
  2. 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 ?)
  3. 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 中的屏幕分辨率对话框获取显示器编号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆