1.ç¨vb.netå¦ä½åå¾macå°åï¼
2.vb2013 如何获得显卡GPU温度
ç¨vb.netå¦ä½åå¾macå°åï¼
è¿æ¯C#çï¼ä½ å¯ä»¥è½¬æ¢ä¸ä¸
using System.Management;
//è·åç½å¡çç³»åå·
private static string GetMacAddress()
{
string ret = "";
try
{
ManagementClass cimobject = new ManagementClass("Win_NetworkAdapterConfiguration");
ManagementObjectCollection moc = cimobject.GetInstances();
if (moc.Count == 0)
return "";
else
{
foreach (ManagementObject mo in moc)
{
if ((bool)mo["IPEnabled"] == true)
{
ret = (string)mo.Properties["MacAddress"].Value;
break;
}
}
}
}
catch
{
ret = "";
}
return ret;
}
vb 如何获得显卡GPU温度
利用 WMI。
.NET 中有个命名空间是源源码净买资金源码 System.Management.ManagementObjectSearcher,可以进行相关硬件设备信息的实例开源免签源码读取。
代码参考:
Dim CPUtprt As Double = 0Dim mos As System.Management.ManagementObjectSearcher = New System.Management.ManagementObjectSearcher("root\WMI",基于idea 看源码 技巧 "Select * From MSAcpi_ThermalZoneTemperature")
For Each mo As System.Management.ManagementObject in mos.Get
CPUtprt = Convert.ToDouble(Convert.ToDouble(mo.GetPropertyValue("CurrentTemperature").ToString()) - ) /
Console.Write("CPU 温度 : " & CPUtprt.ToString & " °C")
Next
注:以上代码为我对照 C# 转换过来的,未经过 IDE 环境下测试。源源码优质头像源码大全
实例源码研究院实例源码研究院