【 tulaoshi.com - 编程语言 】
privatestring[]GetMoc()
{
string[]str=newstring[3];
ManagementClassmcCpu=newManagementClass("win32_Processor");
ManagementObjectCollectionmocCpu=mcCpu.GetInstances();
foreach(ManagementObjectminmocCpu)
{
str[0]=m["ProcessorId"].ToString();
}
ManagementClassmcHD=newManagementClass("win32_logicaldisk");
ManagementObjectCollectionmocHD=mcHD.GetInstances();
foreach(ManagementObjectminmocHD)
{
if(m["DeviceID"].ToString()=="C:")
{
str[1]=m["VolumeSerialNumber"].ToString();
break;
}
}
ManagementClassmcMAC=newManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollectionmocMAC=mcMAC.GetInstances();
foreach(ManagementObjectminmocMAC)
{
if((bool)m["IPEnabled"])
{
str[2]=m["MacAddress"].ToString();
break;
}
}
returnstr;
}