Get Exact Monitor/Display/Screen Name

可紊 提交于 2020-01-06 23:41:52

问题


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

I have already tried the following:

  • Screen.AllScreens is of no use;
  • WMI and Win32 EnumDisplayDevices both returns Generic PnP Monitor;
  • Device Manager also shows Generic PnP Monitor...

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

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?


回答1:


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);
}

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);
}



回答2:


Looks like this might have already been answered in a different question: How do i get the actual monitor name as seen in the resolution dialog



来源:https://stackoverflow.com/questions/14989079/get-exact-monitor-display-screen-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!