日期:2014-05-18 浏览次数:21304 次
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Management; namespace 显示cpu信息 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from Win32_PhysicalMedia"); String strHardDiskID = null; foreach (ManagementObject mo in searcher.Get()) { strHardDiskID = mo["SerialNumber"].ToString().Trim(); break; } textBox8.Text = strHardDiskID; } } }