Need a VB Code for finding Hard Disk Serial No.
Just curious that, can we change this number or it's fixed or when does is changes.
Thanks in advance...
Printable View
Need a VB Code for finding Hard Disk Serial No.
Just curious that, can we change this number or it's fixed or when does is changes.
Thanks in advance...
cant change that its fixed.......but it changes if the hard drive is formatted just so you know
check out this post
http://www.vbforums.com/showthread.p...=serial+number
.....
Thanks for that but I need to find the serial number...
As we've discussed before, it's not strictly a serial number since it changes on formatting. Serial numbers in the strict sense, are allocated serially by say a manufacturer, for various purposes. Eg the VIN on your car identifies it in case of theft, or on your microwave would indicate the date of manufacture for warranty purposes.
A serial number which changes is bloody stupid. Some software makers generate a licence string based on the hdd serial number, so if you re-format your drive you have to go through the whole rigmarole of getting a new licence.
TA JIM,
Need the exact thing, every time you format the HDD need new SERIAL.
Also can u or some else can send me a VB CODE for finding out MOTHER BOARD's SERIAL NO.
Not sure about the mother board serial number but here's a simple way to get HDD SN using GetVolumeInformation API.
All u'll need is a commandButton and a textBox for this one.
Compile to exe and move it around different drives to get the drive's S N.
Hope it helps...
VB Code:
Option Explicit Private Declare Function GetVolumeInformation 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 Private Sub Command1_Click() Dim Serial As Long Dim VName As String, drvlettr As String, FSName As String Dim lFs As Long VName = String$(255, Chr$(0)) FSName = String$(255, Chr$(0)) On Error GoTo ErrorHandler drvlettr = Left$(App.Path, 3) 'Get serial # from GetVolumeInformation API GetVolumeInformation drvlettr, VName, 255, Serial, 0, lFs, FSName, 255 Text1.Text = "The serial number of " & drvlettr & " is '" & Trim(Str$(Serial)) & "'" Exit Sub ErrorHandler: MsgBox "Error " & Err.Number & " (" & Err.Description & ")" End Sub
Why does the VOL command in DOS give a different HDD serial number than the one given by the API above?Quote:
Originally posted by daydee
Not sure about the mother board serial number but here's a simple way to get HDD SN using GetVolumeInformation API.
All u'll need is a commandButton and a textBox for this one.
Compile to exe and move it around different drives to get the drive's S N.
Hope it helps...
VB Code:
Option Explicit Private Declare Function GetVolumeInformation 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 Private Sub Command1_Click() Dim Serial As Long Dim VName As String, drvlettr As String, FSName As String Dim lFs As Long VName = String$(255, Chr$(0)) FSName = String$(255, Chr$(0)) On Error GoTo ErrorHandler drvlettr = Left$(App.Path, 3) 'Get serial # from GetVolumeInformation API GetVolumeInformation drvlettr, VName, 255, Serial, 0, lFs, FSName, 255 Text1.Text = "The serial number of " & drvlettr & " is '" & Trim(Str$(Serial)) & "'" Exit Sub ErrorHandler: MsgBox "Error " & Err.Number & " (" & Err.Description & ")" End Sub
Get MotherBoard Serial NumberQuote:
Originally posted by wrack
Also can u or some else can send me a VB CODE for finding out MOTHER BOARD's SERIAL NO.
hello all,
i am use this code. but i get hard disk serial no not drive no.
this code use give a drive serial no. if u format then change serial no. but i want hard disk serial no this no not change after formating
so plz help me.
thx in advace
regards,
piyush