将WmiMonitorID匹配到Screen类? [英] Matching WmiMonitorID to Screen class?
问题描述
我正在尝试制作一个可以对任何监视器进行屏幕截图的简单屏幕截图程序.为了使它看起来更好,我想使用监视器名称,以便选择屏幕截图中的监视器.我的问题是我找不到合适的方法进行关联 WmiMonitorID.UserFriendlyName到屏幕.有任何建议吗?
>>我的问题是我找不到合适的方法将WmiMonitorID.UserFriendlyName与屏幕相关联.有什么建议吗?
您是说要获取监视器的名称吗?
如果是这样,我建议您从下载此工具 Microsoft WMI代码生成器,用于生成vb.net代码以通过WMI获得该名称.
此外,这是获取该信息的另一种方法,如果可能的话,您可以进行检查.
导入System.Management 公开课表格1 私有子Button1_Click(作为对象发送,作为EventArgs发送)处理Button1.Click 昏暗q作为新的SelectQuery(选择名称,设备ID,来自Win32_DesktopMonitor的描述") 使用mos作为新的ManagementObjectSearcher(q) 对于mos中的每个Mo作为ManagementObject.[Get]() Console.WriteLine("{0},{1},{2}",mo.Properties(名称").Value.ToString(),mo.Properties("DeviceID").Value.ToString( ),mo.Properties("Description").Value.ToString()) 下一个 最终使用 结束子 结束班级
否则,您可以与我们分享更多详细信息.
致谢.
I am trying to make a simple screenshot program that can screenshot any monitor. To make it look nicer I wanted to have the monitor name when available to choose which monitor your screenshotting. My problem is I cannot find a decent method to correlate the WmiMonitorID.UserFriendlyName to a screen. Any suggestions?
Hi,
>>My problem is I cannot find a decent method to correlate the WmiMonitorID.UserFriendlyName to a screen. Any suggestions?<<
Do you mean that you want to get the name of the Monitor?
If so, I would suggest you download this tool from Microsoft WMI Code Generator to generate the vb.net code to get that name with WMI.
In addition, here is another way to get that information, if possible you could have a check.
Imports System.Management Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim q As New SelectQuery("SELECT Name, DeviceID, Description FROM Win32_DesktopMonitor") Using mos As New ManagementObjectSearcher(q) For Each mo As ManagementObject In mos.[Get]() Console.WriteLine("{0}, {1}, {2}", mo.Properties("Name").Value.ToString(), mo.Properties("DeviceID").Value.ToString(), mo.Properties("Description").Value.ToString()) Next End Using End Sub End Class
If not, you could share more detailed information with us.
Regards.
这篇关于将WmiMonitorID匹配到Screen类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!