主题:c#读取计算机CPU,HDD信息
想知道计算机CPU,HDD的信息吗
请大家快看我的笔记吧。
C# 读取计算机CPU,HDD信息
public string getCpuInfo() //读取CPU信息
{
ManagementClass mobj = new ManagementClass("Win32_Processor");
ManagementObjectCollection moc = mobj.GetInstances();
foreach (ManagementObject mo in moc)
{
return mo.Properties["ProcessorId"].Value.ToString();
}
return "";
}
public string getHddInfo() //读取硬盘信息
{
ManagementClass mobj = new ManagementClass("Win32_PhysicalMedia");
ManagementObjectCollection moc = mobj.GetInstances();
foreach (ManagementObject mo in moc)
{
return mo.Properties["SerialNumber"].Value.ToString();
}
return "";
}
详情请看:http://www.cpbdqn.com
请大家快看我的笔记吧。
C# 读取计算机CPU,HDD信息
public string getCpuInfo() //读取CPU信息
{
ManagementClass mobj = new ManagementClass("Win32_Processor");
ManagementObjectCollection moc = mobj.GetInstances();
foreach (ManagementObject mo in moc)
{
return mo.Properties["ProcessorId"].Value.ToString();
}
return "";
}
public string getHddInfo() //读取硬盘信息
{
ManagementClass mobj = new ManagementClass("Win32_PhysicalMedia");
ManagementObjectCollection moc = mobj.GetInstances();
foreach (ManagementObject mo in moc)
{
return mo.Properties["SerialNumber"].Value.ToString();
}
return "";
}
详情请看:http://www.cpbdqn.com