wmi c# - WMI 给出不正确的电压读数
所以我用 WPF、C# 和 WMI 编写了一个程序作为一个小项目来收集计算机的规格,并将其放在 SourceForge 上,因为它对我来说没什么用处。
我很快发现 SoftPedia 已经发现了它,并在他们的屏幕截图中注意到电压读数有错误。这是从他们的页面上截取的图像:
https://i.sstatic.net/8QpBq.png
目前,我使用“CurrentVoltage”来获取电压,例如
foreach (var item in new ManagementObjectSearcher("Select * from Win32_Processor").Get())
{
labelName.Content = (decimal.Parse(item["CurrentVoltage"].ToString()) / 10).ToString() + " v";
}
正如您在图像中看到的,它在图片中的读数为 0v。我想知道是否需要将“CurrentVoltage”切换为“VoltageCaps”,或者是否需要执行诸如直接读取 SMBIOS 之类的操作。
如果是后者,请具体说明如何操作,谢谢。
So I made a program with WPF, C# and WMI as a small project to gather the specifications of a computer, and put it on SourceForge because it was of little use to me.
I soon discovered that SoftPedia had picked it up, and noticed in their screenshot that there was an error with the voltage reading. This is an image nicked from their page:
https://i.sstatic.net/8QpBq.png
At the moment I source the voltage by using "CurrentVoltage", e.g.
foreach (var item in new ManagementObjectSearcher("Select * from Win32_Processor").Get())
{
labelName.Content = (decimal.Parse(item["CurrentVoltage"].ToString()) / 10).ToString() + " v";
}
As you can see in the image, it's reading as 0v in the picture. I was wondering if I would need to switch "CurrentVoltage" to "VoltageCaps", or if I would need to do something like reading the SMBIOS directly.
If the latter, please specify how to do so, thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基于 Win32_Processor 的文档类:
这意味着,如果用
0x80
屏蔽时读取为0
,那么您应该使用VoltageCaps
中的值将电压“声明”为 1VoltageCaps
列出的 3 个值中的一个,除非查询结果为NULL
,在这种情况下电压未知。Based on the documentation for the Win32_Processor class:
This means that if it reads as
0
when masked with0x80
, then you should use the value fromVoltageCaps
to 'state' the voltage as one of the 3 listed values forVoltageCaps
, unless the result of querying isNULL
, in which case the voltage is unknown.