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.:wave:
Printable View
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.:wave:
On most systems the processors that have a serial number have it disabled in the BIOS.
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.
If you want a unique(GUID) related to the machine's hardware, this should be adequate:
vb Code:
Private Const HW_PROFILE_GUIDLEN = 39 Private Const MAX_PROFILE_LEN = 80 Public Type HW_PROFILE_INFO dwDockInfo As Long szHwProfileGuid As String * HW_PROFILE_GUIDLEN szHwProfileName As String * MAX_PROFILE_LEN End Type Public Declare Function GetCurrentHwProfile _ Lib "advapi32" _ Alias "GetCurrentHwProfileA" _ (HwProfileInfo As HW_PROFILE_INFO) _ As Long Public Function SystemGUID() As String Dim HWINFO As HW_PROFILE_INFO GetCurrentHwProfile HWINFO SystemGUID = HWINFO.szHwProfileGuid 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:
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 Public Function VolumeSerialNumber(ByVal RootPath As String) As String Dim VolLabel As String Dim VolSize As Long Dim Serial As Long Dim maxLen As Long Dim flags As Long Dim name As String Dim NameSize As Long Dim s As String If GetVolumeSerialNumber(RootPath, VolLabel, VolSize, Serial, maxLen, flags, name, NameSize) Then s = Format(Hex(Serial), "00000000") VolumeSerialNumber = Left(s, 4) + "-" + Right(s, 4) Else VolumeSerialNumber = "0000-0000" End If End Function 'example call: sVolumeSerial = VolumeSerialNumber("C:\")
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:
Set wmiobjectset = GetObject("winmgmts:\\.\root\CIMV2").ExecQuery("SELECT * FROM Win32_Processor") For Each WMIObject In wmiobjectset msgbox = WMIObject.properties_("processorid") Next Set wmiobjectset = Nothing