Hard Drive Serial Numbers
Quote:
>Is there anyway to find the serial number of a hard drive using vb3.0?
Id that what you're looking or ?? Leme know !
'* Declare Functions
Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA"
(ByVal lpBuffer As String, ByVal nSize As Long) As Long
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
'* Local declaration
Dim ResultDev As Long
Dim lpRootPathName As String
Dim lpVolumeNameBuffer As String
Dim nVolumeNameSize As Long
Dim lpMaximumComponentLength As Long
Dim lpFileSystemFlags As Long
Dim lpFileSystemNameBuffer
Dim nFileSystemNameSize As Long
'* Get Windows Directory Name
lpBuffer = String(50, " ")
nSize = 100
nWindowsPath = GetWindowsDirectory(lpBuffer, nSize)
'* Get Disk Serial Number where Windows is installed
lpRootPathName = Left$(lpBuffer, 3) '* Get Drive Letter on witch Win is
installed
lpVolumeNameBuffer = String(12, " ")
nVolumeNameSize = 20
lpMaximumComponentLength = 48
lpFileSystemFlags = &H2
lpFileSystemNameBuffer = "FAT"
nFileSystemNameSize = 32
'* Function to retreive the volume serial number and other informations
ResultDev = GetVolumeInformation(lpRootPathName, lpVolumeNameBuffer,
nVolumeNameSize, lpVolumeSerialNumber, lpMaximumComponentLength,
lpFileSystemFlags, lpFileSystemNameBuffer, nFileSystemNameSize)
Stephane L Come
Oracle DBA, LeyLinks, Switzerland