Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
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
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 4-Nov-12 15:04pm
sean871501

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 298
1 Sergey Alexandrovich Kryukov 181
2 Yogesh Kumar Tyagi 165
3 ChauhanAjay 156
4 Richard Deeming 150
0 Sergey Alexandrovich Kryukov 6,218
1 OriginalGriff 5,413
2 CPallini 2,473
3 Richard MacCutchan 1,627
4 Abhinav S 1,530


Advertise | Privacy | Mobile
Web02 | 2.8.140814.1 | Last Updated 4 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100