title: EnumDisplayDevices vs WMI Win32_DesktopMonitor, how to detect active monitors?
body: <p>For my current C++ project I need to detect a unique string for every monitor that is connected and active on a large number of computers. </p>
  
  <p>Research has pointed to 2 options</p>
  
  <ol>
  <li><p>Use WMI and query the Win32_DesktopMonitor for all active monitors. Use the PNPDeviceID for unique identification of monitors.</p></li>
  <li><p>Use the EnumDisplayDevices API, and dig down to get the device ID.</p></li>
  </ol>
  
  <p>I'm interested in using the device id for unique model identification because monitors using the default plug and play driver will report a generic string as the monitor name "default plug and play monitor"  </p>
  
  <p>I have been experiencing issues with the WMI method, it seems to be only returning 1 monitor on my Vista machine, looking at the doco it turns out it does not work as expected on non WDDM devices. </p>
  
  <p>The EnumDisplayDevices seems to be a little problematic to get going when it runs from a background service (especially on Vista), If it's in session 0 it will return no info. </p>
  
  <ul>
  <li><p>Has anyone else had to do something similar (find unique model string for all connected active monitors?) </p></li>
  <li><p>What approach worked best?</p></li>
  </ul>