WMI Get All Monitors Not Returning All Monitors

后端 未结 4 1126
余生分开走
余生分开走 2021-01-04 21:02

I am using WMI Win32_MonitorDesktop to get all the monitors information on the system.

However it only returns one. I have tried it on several computers

相关标签:
4条回答
  • This certainly does not answer your actual question but most reliable way of figuring out monitor information is to read following registry:

    "SYSTEM\CurrentControlSet\Enum\DISPLAY\"
    

    under HKEY_LOCAL_MACHINE

    0 讨论(0)
  • 2021-01-04 21:16

    It could be that the monitors are set up in a horizontal span mode (NV and ATI cards) which effectively make multiple monitor setups into one big monitor? Otherwise, I'll continue to have a think..

    Also the MSDN quite specifically states that if this WMI call is used with anything pre-vista it will yield inaccurate results!?

    0 讨论(0)
  • 2021-01-04 21:19

    I tried to resolve this problem using WMI on many systems (from WinXP-SP3 up to Win10), and I got different results on different machines. There are two tables, where current monitor setting can be stored. First is Win32_DesktopMonitor in cimv2 namespace, second is WMIMonitorID in wmi namespace. If one of them has only one record (in multi display setting), then second will have all of entries.

    Then to get driver name of monitor, one should find devices with PnPDeviceID found in records from those tables in Win32_PnPEntity table, in cimv2 namespace. You can check sample solution here.

    0 讨论(0)
  • 2021-01-04 21:36

    I use the same code from wmi (win32_Desktopmonitor) on a windows 7 machine. It doen't work there as well, in the sense that only 1 monitor is returned, where there are really two.

    Also Screen.Allscreens.Length, only returns 1 monitor. The only way to get the system to return 2 monitors, is to extend the desktop to the two monitors, but that's not what most people do.

    0 讨论(0)
提交回复
热议问题