|
-
May 21st, 2002, 01:55 AM
#1
Thread Starter
^:^...ANGEL...^:^
Hdd Serial...
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...
-
May 21st, 2002, 02:11 AM
#2
Frenzied Member
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
-
May 21st, 2002, 02:11 AM
#3
Thread Starter
^:^...ANGEL...^:^
Need this fast...
-
May 21st, 2002, 02:25 AM
#4
Thread Starter
^:^...ANGEL...^:^
OK...
Thanks for that but I need to find the serial number...
-
May 21st, 2002, 02:26 AM
#5
Hyperactive Member
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.
-
May 22nd, 2002, 01:27 AM
#6
Thread Starter
^:^...ANGEL...^:^
any other way...
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.
-
May 22nd, 2002, 02:20 AM
#7
Fanatic Member
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
-
Jun 5th, 2002, 05:24 PM
#8
PowerPoster
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
Why does the VOL command in DOS give a different HDD serial number than the one given by the API above?
-
Jun 5th, 2002, 05:50 PM
#9
Originally posted by wrack
Also can u or some else can send me a VB CODE for finding out MOTHER BOARD's SERIAL NO.
Get MotherBoard Serial Number
-
Aug 1st, 2008, 01:50 AM
#10
New Member
Re: Hdd Serial...
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
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
|