Saturday, January 8, 2011

Get the processor id using c#

Get the processor id using c#

First add the reference  System.Management from COM tab.

Code:

using System.Management;

ManagementObjectSearcher mo = new ManagementObjectSearcher("select * from Win32_Processor");

foreach (ManagementObject mob in mo.Get())
{

   try
  {
      listBox1.Items.Add(mob["ProcessorId"].ToString());
  }
  catch (Exception ex)
  {
       // handle exception
  }

}

No comments:

Post a Comment