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]

# 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
# 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