PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Processor serial-VBForums
Results 1 to 5 of 5

Thread: Processor serial

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2009
    Posts
    98

    Angry Processor serial

    Hi! Can any one tell how we code a program with one command and text box to get or view processor serial number.
    Thank you.

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,322

    Re: Processor serial

    On most systems the processors that have a serial number have it disabled in the BIOS.

  3. #3
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Processor serial

    It'll be hard as it could be considered a privacy issue, that Pentium 3 had back in the day. Check this article out http://en.wikipedia.org/wiki/Pentium...privacy_issues

    I'm guessing you want this as a registration scheme? Seems to be a frequent question. You may have to settle for volume serial number of a partition.

  4. #4
    Fanatic Member FireXtol's Avatar
    Join Date
    Apr 2010
    Posts
    874

    Re: Processor serial

    If you want a unique(GUID) related to the machine's hardware, this should be adequate:

    vb Code:
    1. Private Const HW_PROFILE_GUIDLEN = 39
    2. Private Const MAX_PROFILE_LEN = 80
    3.  
    4. Public Type HW_PROFILE_INFO
    5. dwDockInfo As Long
    6. szHwProfileGuid As String * HW_PROFILE_GUIDLEN
    7. szHwProfileName As String * MAX_PROFILE_LEN
    8. End Type
    9.  
    10. Public Declare Function GetCurrentHwProfile _
    11. Lib "advapi32" _
    12. Alias "GetCurrentHwProfileA" _
    13. (HwProfileInfo As HW_PROFILE_INFO) _
    14. As Long
    15.  
    16. Public Function SystemGUID() As String
    17. Dim HWINFO As HW_PROFILE_INFO
    18. GetCurrentHwProfile HWINFO
    19. SystemGUID = HWINFO.szHwProfileGuid
    20. End Function

    NOTE: Some OEM machines(like a specific model of a Dell, for instance) have identical GUIDs. So you may want to hash together some additional information, like the volume serial for "C:\".

    Like this:

    vb Code:
    1. Declare Function GetVolumeSerialNumber Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
    2.  
    3. Public Function VolumeSerialNumber(ByVal RootPath As String) As String
    4. Dim VolLabel As String
    5. Dim VolSize As Long
    6. Dim Serial As Long
    7. Dim maxLen As Long
    8. Dim flags As Long
    9. Dim name As String
    10. Dim NameSize As Long
    11. Dim s As String
    12. If GetVolumeSerialNumber(RootPath, VolLabel, VolSize, Serial, maxLen, flags, name, NameSize) Then
    13.   s = Format(Hex(Serial), "00000000")
    14.   VolumeSerialNumber = Left(s, 4) + "-" + Right(s, 4)
    15. Else
    16.   VolumeSerialNumber = "0000-0000"
    17. End If
    18. End Function
    19.  
    20. 'example call:
    21. sVolumeSerial = VolumeSerialNumber("C:\")

  5. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,381

    Re: Processor serial

    you can use WMI like this, to return processor id
    whether this will work with all machines, i can not say, certainly works on my laptops
    needs WMI not to have been disabled and XP or later
    vb Code:
    1. Set wmiobjectset = GetObject("winmgmts:\\.\root\CIMV2").ExecQuery("SELECT * FROM Win32_Processor")
    2. For Each WMIObject In wmiobjectset
    3.     msgbox = WMIObject.properties_("processorid")
    4. Next
    5. Set wmiobjectset = Nothing
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width