如何使用WMI获取CPU序列号?
//返回的是一个数组,可能存在多个CPU
using System;
using System.Management;
using System.Collections;
public ArrayList GetCpuID()
{
ArrayList al=new ArrayList();
try
{
ManagementClass mc = new ManagementClass("Win32_Processor");
ManagementObjectCollection moc = mc.GetInstances();
foreach( ManagementObject mo in moc )
{
al.Add(mo.Properties["ProcessorId"].Value.ToString());
}
return al;
}
catch()
{
return null;
}
}
本文地址:http://www.45fan.com/a/question/72829.html