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 "";
}
摘自 愛智旮旯