Click here to Skip to main content
15,880,543 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i need help in order to get my cpu id in the programming language visual basic
what i really want to do is to get the cup id to be on a label

i try this code but i get a load of errors
here it is
Imports System.Management
VB
Dim objMOS As ManagementObjectSearcher

        Dim objMOC As Management.ManagementObjectCollection

        Dim objMO As Management.ManagementObject

        objMOS = New ManagementObjectSearcher("Select * From Win32_Processor")

        objMOC = objMOS.Get

        For Each objMO In objMOC

            Label31.Text = ("CPU ID = " & objMO("ProcessorID"))

        Next

        objMOS.Dispose()

        objMOS = Nothing

        objMO.Dispose()

        objMO = Nothing
Posted

1 solution

And the errors would be .....???


CPUID returns information about the processor. It is not the unique serial number for your particular processor.

You might want to read up on what the ProcessorID field returns, here[^], and what is returned when EAX is set to 1 during the call to CPUID. That would be the Processor Info and Feature Bits, but all of them. The docs on that can be found here[^].


Oh, and you forgot this:
Label31.Text = "CPU ID = " & objMO("ProcessorID").Value
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900