public static void getcpuinfo(out string cpuinfo)
{
//得到cpu信息
string _cpuinfo="";//cpu信息
managementclass cimobject = new managementclass("win32_processor");
managementobjectcollection moc = cimobject.getinstances();
foreach(managementobject mo in moc)
{
_cpuinfo = mo.properties["processorid"].value.tostring();
}
cpuinfo=_cpuinfo;
}
//获取硬盘id
string _hdinfo="";
managementclass cimobject1 = new managementclass("win32_diskdrive");
managementobjectcollection moc1 = cimobject1.getinstances();
foreach(managementobject mo in moc1)
{
_hdinfo = (string)mo.properties["model"].value;
}
hdinfo=_hdinfo;
}
public static void getmacaddress(out string macaddress)
{
//获取网卡硬件地址
string _macaddress="";
managementclass mc = new managementclass("win32_networkadapterconfiguration");
managementobjectcollection moc2 = mc.getinstances();
foreach(managementobject mo in moc2)
{
if((bool)mo["ipenabled"] == true)
macaddress=mo["macaddress"].tostring();
mo.dispose();
}
macaddress=_macaddress;
}
新闻热点
疑难解答
图片精选