I want to get each display's information like shown in Windows display settings. I use the following code to get each monitor's info:
int ENUM_CURRENT_SETTINGS = -1;
foreach (Screen screen in Screen.AllScreens)
{
DEVMODE dm = new DEVMODE();
dm.dmSize = (short)Marshal.SizeOf(typeof(DEVMODE));
EnumDisplaySettings(screen.DeviceName, ENUM_CURRENT_SETTINGS, ref dm);
Console.WriteLine($"Device: {screen.DeviceName}");
Console.WriteLine($"Real Resolution: {dm.dmPelsWidth}x{dm.dmPelsHeight}");
Console.WriteLine($"Virtual Resolution: {screen.Bounds.Width}x{screen.Bounds.Height}");
Console.WriteLine();
}
The result looks like this:
But the screen name is not the same as shown in Windows display settings. My Windows display settings looks like this:
My question is, how can my code get the same info that is shown in Windows display settings?