How To Get HWID In C#

How To Get HWID In C#
I think some of you know that i have write a tutorial to get the HWID in vb.net , if you want to look at it you can go here . coming to the point now to get the HWID first of all it's something with your system so first go ahead and add right click your project name and select add reference then a windows will pop up now go to .NET tab and search for System.Management when you found that tick it and click ok.
reference adding Now just use a event and make this this code work , codes are commented so no worries and no confusions.
            //Author : Mohamed Shimran
            //Blog : http://ultimateprogrammingtutorials.blogspot.com
            string HWID = string.Empty;//creating a empty string
            ManagementClass Management = new ManagementClass("win32_processor");//declaring the system management calss
            ManagementObjectCollection MObject = Management.GetInstances();//decalring the system management object collection 
            foreach (ManagementObject mob in MObject)//having a foreach loop
            {
                if (string.IsNullOrEmpty(HWID))
                {
                    HWID = mob.GetPropertyValue("processorID").ToString();//converting the HWID to string
                    break;
                }
            }
          MessageBox.Show("Your HWID : " + HWID, " HWID" ,MessageBoxButtons.OK,MessageBoxIcon.Information );//displaying the HWID from Message Box
Now debug your program then use the event that you added the code then a message box will pop up with your HWID by the way you can make a label , textbox etc to display the HWID easily , if you still have any confusions just comment below .
here HWID
I am using the windows classic now because i just need my computer to be faster not slower . Enjoy 

2 comments

can somebody tellme why it is not working? system.management already active
http://prntscr.com/djl1qo

Reply

@Andre : add reference System.Management?

Reply

Post a Comment

Note: Only a member of this blog may post a comment.