WMI Get All Monitors Not Returning All Monitors

后端 未结 4 1123
余生分开走
余生分开走 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条回答
  •  有刺的猬
    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.

提交回复
热议问题