Private Declare Function GetLogicalDriveStrings Lib "kernel32" Alias "GetLogicalDriveStringsA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private 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
Private Const FS_CASE_IS_PRESERVED = &H2
Private Const FS_CASE_SENSITIVE = &H1
Private Const FS_UNICODE_STORED_ON_DISK = &H4
Private Const FS_PERSISTENT_ACLS = &H8
Private Const FS_FILE_COMPRESSION = &H10
Private Const FS_VOL_IS_COMPRESSED = &H8000
Private Sub Form_Load()
Dim s$
Dim n&
s$ = String$(2048, 0)
Call GetLogicalDriveStrings(2047, s$)
Do
n = InStr(s$, Chr$(0))
If n > 1 Then
List1.AddItem Left$(s$, n - 1)
s$ = Mid$(s$, n + 1)
End If
Loop Until n <= 1
List1.ListIndex = 0
End Sub
Private Sub List1_Click()
Dim volbuf$, sysname$
Dim serialnum&, sysflags&, componentlength&
Dim res&
List2.Clear
volbuf$ = String$(256, 0)
sysname$ = String$(256, 0)
res = GetVolumeInformation(List1.Text, volbuf$, 255, serialnum, _
componentlength, sysflags, sysname$, 255)
If res = 0 Then
List2.AddItem "Unable to retrieve volume information"