Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I get the actual Monitor name? as seen in the resolution dialog
    primarykey
    data
    text
    <p>I am trying to grab the friendly name for the monitors on my system. I am using C#.</p> <p>I have tried <code>Screen</code>, which just gives me <code>//./DisplayXX</code>. I have also tried both <code>Win32_DesktopMonitor</code> and <code>EnumDisplayDevices</code>, they all give me variations of <code>//./DisplayXX</code> OR <code>Generic Monitor</code>, whereas I know my displays names are <code>SyncMaster</code> and <code>SM2333T</code>.</p> <p>Now Windows knows what these monitors are, displays them in the <strong>Devices and Printers</strong> windows with the correct names, and also in the dialog for setting location and resolution.</p> <p>Where can I grab these names from? I have looked in the registry and cant seem to find them, so any help will be great.</p> <p><strong>SOLUTION:</strong> The issue I had was when calling <code>EnumDisplayDevices</code> the second time I was setting <code>iDevNum</code> to id again, which meant I was trying to grab data from the wrong place, I then replaced this with 0, and it works perfectly, see below for the code.</p> <pre><code> var device = new DISPLAY_DEVICE(); device.cb = Marshal.SizeOf(device); try { for (uint id = 0; EnumDisplayDevices(null, id, ref device, 0); id++) { Console.WriteLine(String.Format("{0}, {1}, {2}, {3}, {4}, {5}", id, device.DeviceName, device.DeviceString, device.StateFlags, device.DeviceID, device.DeviceKey)); Console.WriteLine(); device.cb = Marshal.SizeOf(device); EnumDisplayDevices(device.DeviceName, 0, ref device, 0); Console.WriteLine(String.Format("{0}, {1}, {2}, {3}, {4}, {5}", id, device.DeviceName, device.DeviceString, device.StateFlags, device.DeviceID, device.DeviceKey)); device.cb = Marshal.SizeOf(device); device.cb = Marshal.SizeOf(device); return; } } } catch (Exception ex) { Console.WriteLine(String.Format("{0}", ex.ToString())); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload