问题
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