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
Const FILE_VOLUME_IS_COMPRESSED = &H8000
Public Sub GetVolInfo(Byval Path as String)
Dim aa As Long
Dim VolName As String
Dim fsysName As String
Dim path As String
Dim VolSeri As Long, compress As Long
Dim Sysflag As Long, Maxlen As Long
VolName = String(255, 0)
fsysName = String(255, 0)
aa = GetVolumeInformation(path, VolName, 256, VolSeri, Maxlen, _
Sysflag, fsysName, 256)
VolName = Left(VolName, InStr(1, VolName, Chr(0)) - 1)
fsysName = Left(fsysName, InStr(1, fsysName, Chr(0)) - 1)
compress = Sysflag And FILE_VOLUME_IS_COMPRESSED
If compress = 0 Then
Debug.Print "非Compress之Volume"
Else
Debug.Print "Compress之Volume"
End If
Debug.Print "Volume Name :", VolName
Debug.Print "Volume Serical# : ", Hex(VolSeri)
Debug.Print "Name of the file system (such as FAT, HPFS, or NTFS)", fsysName
Debug.Print "Max Length of File Name ", Maxlen
End Sub
Private Sub Command1_Click()
Call GetVolInfo("c:\")
End sub