在編寫WPF應用程序時,我想要獲取在標準窗口顯示設置對話框中找到的顯示名稱。我試過WMI查詢Win32_DesktopMonitor和System.Windows.Forms.Screen.AllScreens。獲取與在顯示設置中找到的顯示名稱相匹配的名稱
,顯示在標準的Windows顯示設置列表中的名稱是:
Mobile PC Display
DELL 2407WFP
Win32_DesktopMonitor提供了以下(剝離不相關的信息):
DISPLAY 1
Caption = Generic PnP Monitor
CreationClassName = Win32_DesktopMonitor
Description = Generic PnP Monitor
DeviceID = DesktopMonitor1
MonitorManufacturer = (Standard monitor types)
MonitorType = Generic PnP Monitor
Name = Generic PnP Monitor
PNPDeviceID = DISPLAY\DELA017\5&2F0149CC&0&UID1078064
DISPLAY 2
Caption = Generic PnP Monitor
CreationClassName = Win32_DesktopMonitor
Description = Generic PnP Monitor
DeviceID = DesktopMonitor2
MonitorManufacturer = (Standard monitor types)
MonitorType = Generic PnP Monitor
Name = Generic PnP Monitor
PNPDeviceID = DISPLAY\CMO1720\4&164FD10C&0&UID67568640
System.Windows.Forms.Screen。 AllScreens提供設備清單(無關信息除外):
DISPLAY 1
DeviceName = \\.\DISPLAY1
DISPLAY 2
DeviceName = \\.\DISPLAY3
很明顯,我應該能夠交叉引用設備名稱,設備ID或PNPDeviceID與其他地方的名單來獲取名稱,不是嗎?
請不要因爲這個而憋悶我,我搜索了所有我能想到的東西,我發現的所有信息都是關於AllScreens和Win32_DesktopMonitor的信息,但沒有找到我們在標準窗口顯示設置對話框中看到的顯示名稱。
非常感謝。
DISPLAY_DEVICE是不是在C#中已知的任何類雖然。這是從哪裏來的,如何在C#中訪問?我得到的只是(相當有限的)「屏幕」類。 – Nyerguds
這不是一個類,它是我的文章中的結構。 – Lennart