title: EnumDisplayDevices not returning anything
body: <p>I am having an issue working with EnumDisplayDevices in C#. I used the code posted <a href="https://stackoverflow.com/questions/4958683/how-do-i-get-the-actual-monitor-name-as-seen-in-the-resolution-dialog">here</a> and it  worked seamlessly. However recently I switched to coding the application on my desktop computer. The code no longer works, not giving me anything.</p>
  
  <p>If it helps, my monitor is an LG W2753VC running on an AMD Radeon HD 5770.</p>
  
  <p>Here is my current 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++) {
                  device.cb = Marshal.SizeOf(device);
                  EnumDisplayDevices(device.DeviceName, 0, ref device, 0);
                  device.cb = Marshal.SizeOf(device);
  
                  Console.WriteLine("id={0}, name={1}, devicestring={2}", id, device.DeviceName, device.DeviceString);
                  if (device.DeviceName == null || device.DeviceName == "") continue;
              }
          } catch (Exception ex) { }
  </code></pre>
  
  <p>What I'm getting on my laptop:</p>
  
  <pre><code>id=0, name=\\.\DISPLAY1\Monitor0, devicestring=Generic PnP Monitor
  </code></pre>
  
  <p>(That should be "Mobile PC Display", but it's not the problem here)</p>
  
  <p>What I'm getting on my desktop:</p>
  
  <pre><code>id=0, name=, devicestring=
  id=1, name=, devicestring=
  </code></pre>
  
  <p>Am I doing this wrong, and if not, is there any other way to get all connected displays? I have already tried the WMI and registry approach.</p>