C # take computer hardware information
// Take the CPU number
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
// Take the first hard disk number
Private string getharddiskid () {
ManagementObjectSearcher Searcher = New ManagementObjectSearcher ("Select * from win32_physicalmedia);
String strharddiskid = null;
ManagementObject Mo in search.get ()) {
StrhardDiskid = Mo ["serialnumber"]. TOSTRING (). TRIM ();
Break;
}
Return Strharddiskid;
} // End Method