就我在互联网上的研究而言,我尝试了一些代码,但它正在发挥作用。它返回'0'值。我的问题是:如何在C#中获得主板和CPU电压信息?
我的代码:
//http://wutils.com/wmi/
//create a management scope object
ManagementScope scope = new ManagementScope("\\\\.\\ROOT\\cimv2");
//create object query
ObjectQuery query = new ObjectQuery("SELECT * FROM CIM_VoltageSensor");
//create object searcher
ManagementObjectSearcher searcher =
new ManagementObjectSearcher(scope, query);
//get collection of WMI objects
ManagementObjectCollection queryCollection = searcher.Get();
//enumerate the collection.
foreach (ManagementObject m in queryCollection)
{
// access properties of the WMI object
Console.WriteLine("Accuracy : {0}", m["Accuracy"]);
}