Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Hard Disk Serial Number ?

hi
i hope fine there.
In VB6
---
Actually i want HardDisk(HDD) Serial No.
for my project Security purpose.
if u have any solution or any link pls say.
Thanks friends.
[204 byte] By [LiveSys] at [2007-11-11 10:25:28]
# 1 Re: Hard Disk Serial Number ?
http://www.google.com/search?q=vb+hard+disk+serial+number
Phil Weber at 2007-11-11 17:22:40 >
# 2 Re: Hard Disk Serial Number ?
This code works in VBA, so might have to modify it a bit to make it work in VB6:

Private Declare Function GetVolumeInformation Lib _
"kernel32.dll" Alias "GetVolumeInformationA" (ByVal _
lpRootPathName As String, ByVal lpVolumeNameBuffer As _
String, ByVal nVolumeNameSize As Integer, _
lpVolumeSerialNumber As Long, lpMaximumComponentLength _
As Long, lpFileSystemFlags As Long, ByVal _
lpFileSystemNameBuffer As String, ByVal _
nFileSystemNameSize As Long) As Long

Function GetSerialNumber(strDrive As String) As Long
Dim SerialNum As Long
Dim Res As Long
Dim temp1 As String
Dim Temp2 As String
temp1 = String$(255, Chr$(0))
Temp2 = String$(255, Chr$(0))
Res = GetVolumeInformation(strDrive, temp1, _
Len(temp1), SerialNum, 0, 0, Temp2, Len(Temp2))
GetSerialNumber = SerialNum
End Function

Private Sub GetHDSerialNumber()
Dim hdnumber As String

MsgBox "Hard Disk Serial Number is : " & (GetSerialNumber("C:\"))

End Sub
unhitchedjet at 2007-11-11 17:23:37 >
# 3 Re: Hard Disk Serial Number ?
http://www.google.com/search?q=vb+hard+disk+serial+number
----------------

Thanks Phil,
i find it. Hard Disk Serial

From this link,
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=57366&lngWId=1

Sir, Good bye
-LiveSys
LiveSys at 2007-11-11 17:24:46 >
# 4 Re: Hard Disk Serial Number ?
This code works in VBA, so might have to modify it a bit to make it work in VB6:
Private Declare Function GetVolumeInformation Lib _
"kernel32.dll" Alias "GetVolumeInformationA" (ByVal _
lpRootPathName As String, ByVal lpVolumeNameBuffer As _
String, ByVal nVolumeNameSize As Integer, _
lpVolumeSerialNumber As Long, lpMaximumComponentLength _
As Long, lpFileSystemFlags As Long, ByVal _
lpFileSystemNameBuffer As String, ByVal _
nFileSystemNameSize As Long) As Long
Function GetSerialNumber(strDrive As String) As Long
Dim SerialNum As Long
Dim Res As Long
Dim temp1 As String
Dim Temp2 As String
temp1 = String$(255, Chr$(0))
Temp2 = String$(255, Chr$(0))
Res = GetVolumeInformation(strDrive, temp1, _
Len(temp1), SerialNum, 0, 0, Temp2, Len(Temp2))
GetSerialNumber = SerialNum
End Function
Private Sub GetHDSerialNumber()
Dim hdnumber As String
MsgBox "Hard Disk Serial Number is : " & (GetSerialNumber("C:\"))
End Sub
====================================================

Thanks For It,
but I want Hard Disk Serial Number, not a drive serial Id.
ok, i find it from this link,

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=57366&lngWId=1

Thanks friend
meet again.
-livesys
LiveSys at 2007-11-11 17:25:40 >