获取确切的监视器/显示/屏幕名称 [英] Get Exact Monitor/Display/Screen Name

查看:247
本文介绍了获取确切的监视器/显示/屏幕名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个程序,用户可以选择目标监视器,但是我无法获得真正的监视器
的名称/型号。

I have a program where user chooses destination monitor but I just can't get the real monitor name/model.

我已经尝试过以下:


  • Screen.AllScreens没有用;

  • WMI和Win32 EnumDisplayDevices都返回Generic PnP监视器;

  • 设备管理器还显示通用PnP监视器...

在资源管理器中显示器的实际名称是什么,在Everest中,它显示的是更详细的信息...

In explorer there are the actual names of monitors attached and in Everest, it shows even more depth in details...

这两个程序从那里获取这些信息?我遇到的
的最后一个选项是从注册表中解析EDID ...是否有人尝试过并且有效?

From where these 2 programs gets those information? The last option I ran into is to parse EDID from registry ... has anyone tried this and did it work?

推荐答案

嗯,这个问题很旧,但是,为了进行Google重定向,我建议使用 WindowsDisplayAPI库。

Well, this question is old, however, as for the sake of google redirects, I suggest the 'WindowsDisplayAPI' library.

https://www.nuget.org/packages/WindowsDisplayAPI

使用库,有多种获取显示名称的方法。最简单的方法是:

Using the library, there are multiple ways to get the display name. The simplest way is:

foreach (var display in Display.GetDisplays())
{
    Console.WriteLine(display.DeviceName);
}

但这是使用旧的API,如果您确定程序目标是至少是Windows Vista,我建议使用以下代码:

But this is using the old API, if you are sure that your program targets at least Windows Vista, I suggest the following code:

foreach (var target in DisplayConfig.PathDisplayTarget.GetDisplayTargets())
{
    Console.WriteLine(target.FriendlyName);
}

这篇关于获取确切的监视器/显示/屏幕名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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