![]() |
|
| How to retrieve the disk serial number? | |
This function will work in VB4/Windows 95:
Private Declare Function GetVolumeInformation& Lib "kernel32" _
Alias "GetVolumeInformationA" _
(ByVal lpRootPathName As String, ByVal pVolumeNameBuffer As String, _
ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, _
lpMaximumComponentLength As Long, lpFileSystemFlags As Long, _
ByVal lpFileSystemNameBuffer As String, _
ByVal nFileSystemNameSize As Long)
Private Const MAX_FILENAME_LEN = 256
'
' Returns a volume's serial number
'
Public Function GetSerialNumber(sDrive As String) As Long
Dim ser As Long
Dim s As String * MAX_FILENAME_LEN
Dim s2 As String * MAX_FILENAME_LEN
Dim i As Long
Dim j As Long
Call GetVolumeInformation(sDrive + ":\", s, MAX_FILENAME_LEN, ser, _
i, j, s2, MAX_FILENAME_LEN)
GetSerialNumber = ser
End Function
|
|
| Mail to Daniel
Wiman <daniel@wimania.com> Online since June 1996, updated 971025 |
<- The VB home <- Daniels homepage |