How can I retrieve monitor information?

Posted by Jon Tackabury on Stack Overflow See other posts from Stack Overflow or by Jon Tackabury
Published on 2010-04-08T13:37:35Z Indexed on 2010/04/08 20:33 UTC
Read the original article Hit count: 229

Filed under:
|
|
|
|

I am trying to retrieve the monitor ID's as shown in the Windows display properties (#1, 2... etc), but I can't seem to find a way. I have tried using EnumDisplayMonitors as well as EnumDisplayDevices. They both return something like "\.\DISPLAY1". However, this number doesn't always match the number shown by Windows, especially when 2 video cards are being used to drive 3 or more monitors. Is there an API call I am missing to retrieve this information, or is there a way to get it from the registry or somewhere else? Thanks!

I have tried these methods:
Win32: EnumDisplayMonitors, EnumDisplayDevices: Neither of these return monitors that aren't active, and neither one returns the correct IDs.
WMI: "select * from Win32_DesktopMonitor" doesn't return all the monitors, and there is no ID.
Registry: I have found the monitors in various locations, none of the places I found have the info I am looking for.

Any help is much appreciated. :)

© Stack Overflow or respective owner

Related posts about win32

Related posts about Windows