codice:
Public Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" _
(ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, _
ByVal nVolumeNameSize As Long, lpVolumeSerial_Numberber As Long, _
lpMaximumComponentLength As Long, lpFileSystemFlags As Long, _
ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
Public Const GETDI_SERIAL = 1
Public Const GETDI_LABEL = 2
Public Const GETDI_TYPE = 3
Function GetDriveInfo(strDrive As String, iType As Integer)
Dim Serial_Number As Long
Dim Drive_Label As String
Dim Fat_Type As String
Dim Return_Value As Long
Drive_Label = Space(256)
Fat_Type = Space(256)
Return_Value = GetVolumeInformation(strDrive, Drive_Label, Len(Drive_Label), Serial_Number, 0, 0, Fat_Type, Len(Fat_Type))
GetDriveInfo = CStr(Serial_Number)
End Function