//取CPU编号
private String GetCpuID() {
ManagementClass mc = new ManagementClass("Win32_Processor");
ManagementObjectCollection moc = mc.GetInstances();
String strCpuID = null ;
foreach( ManagementObject mo in moc ) {
strCpuID = mo.Properties["ProcessorId"].Value.ToString();
break;
}
return strCpuID;
}//end method
//取第一块硬盘编号
private String GetHardDiskID() {
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia");
String strHardDiskID = null ;
foreach(ManagementObject mo in searcher.Get()) {
strHardDiskID = mo["SerialNumber"].ToString().Trim();
break;
}
return strHardDiskID ;
}//end method
C#常用函数列表 | DataGridViewComboEditBoxColumn类,可编辑的ComboBox列[收集] |
C#取计算机硬件信息 | |
[ 发布日期:19年前 (2006-07-14) ] [ 来自:rick@博客园 ] | [分类:C# .Net编程] |
[ 分类:C# .Net编程
| 查看:7100 ]
暂时没有评论,快来发表一个评论吧。
发表评论 |