运行结果:private void Frm_Main_Load(object sender, EventArgs e)
{
//创建ManagementObjectSearcher对象
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia");
String strHardDiskID = null;//存储磁盘序列号
//调用ManagementObjectSearcher类的Get方法取得硬盘序列号
foreach (ManagementObject mo in searcher.Get())
{
strHardDiskID = mo["SerialNumber"].ToString().Trim();//记录获得的磁盘序列号
break;
}
label1.Text = "硬盘序列号: "+strHardDiskID;//显示硬盘序列号
}
亲爱的:被墙域名跳转TG:@qianhenetwork QQ:851617266,可否收藏+评论+分享呢?
文章评论 本文章有个评论