|
-
Jun 5th, 2010, 04:26 PM
#1
Thread Starter
Lively Member
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.
-
Jun 5th, 2010, 06:46 PM
#2
Re: Processor serial
On most systems the processors that have a serial number have it disabled in the BIOS.
-
Jun 5th, 2010, 07:59 PM
#3
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.
-
Jun 5th, 2010, 08:12 PM
#4
Re: Processor serial
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:\")
Last edited by FireXtol; Jun 5th, 2010 at 08:16 PM.
Software I use and highly recommend: Opera, Miranda IM, Peerblock, Winamp, Unlocker Assistant, JoyToKey, Virtual CloneDrive, Secunia PSI, ExplorerXP, GOM Player, Real Alternative, Quicktime Alternative,Sumatra PDF, and non-freeware: Photoshop and VB6( ).
My codebank: AllRGB, Rounded Rectangle(math), Binary Server, Buddy Paint, LoadPictureGDI+, System GUID/Volume Serial, HexToAsc, List all processes and their paths, quasiString matching
Strings(search, extraction, retrieval etc): Retrieve BBCode Link from HTML, RemoveBetween ()'s, strFindBetween(str1,str2), Insert text in HTML, HTML - GetSpanByID
-
Jun 6th, 2010, 02:44 AM
#5
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:
Set wmiobjectset = GetObject("winmgmts:\\.\root\CIMV2").ExecQuery("SELECT * FROM Win32_Processor") For Each WMIObject In wmiobjectset msgbox = WMIObject.properties_("processorid") Next 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|