// Obtain the disk serial number
Try
{
System. Management. ManagementObjectSearcher cmicWmi = new ManagementObjectSearcher ("SELECT * FROM Win32_DiskDrive ");
System. UInt32 tmpUint32 = 0;
Foreach (ManagementObject cmicWmiObj in cmicWmi. Get ())
{
TmpUint32 = Convert. ToUInt32 (cmicWmiObj ["signature"]. ToString ());
}
This. textBox1.Text = tmpUint32.ToString ();
This. gProgressBar1.Value ++;
}
Catch (Exception ex1)
{
Throw new Exception (ex1.ToString ());
}
// Obtain the cpu serial number
Try
{
System. Management. ManagementObjectSearcher Wmi = new ManagementObjectSearcher ("SELECT * FROM Win32_Processor ");
String tmpUint32_1 = string. Empty;
Foreach (ManagementObject WmiObj in Wmi. Get ())
{
TmpUint32_1 = WmiObj ["ProcessorId"]. ToString ();
}
This. textBox2.Text = tmpUint32_1;
This. gProgressBar1.Value ++;
}
Catch (Exception ex2)
{
Throw new Exception (ex2.ToString ());
}