Private Declare Function GetDiskFreeSpace Lib "kernel32" _ Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, _ lpSectorsPerCluster As Long, lpBytesPerSector As Long, _ lpNumberOfFreeClusters As Long, lpTtoalNumberOfClusters As Long) As Long'Path = "c:" 指定Volume 代号, 如: c: d: e:Public Function GetFreeSpace(Byval Path as String) as LongDim aa As LongDim Path As StringDim SecPerClust As LongDim BytePerSec As Long, FreeClust As Long, totClust As LongPath = "c:" '指定Volume 代号, 如: c: d: e:aa = GetDiskFreeSpace(Path, SecPerClust, BytePerSec, FreeClust, totClust)GetFreeSpace = SecPerClust * BytePerSec * FreeClustEnd Function'Path = "c:" 指定Volume 代号, 如: c: d: e:Public Function GetTotalSpace(Byval Path as String) as LongDim aa As LongDim Path As StringDim SecPerClust As LongDim BytePerSec As Long, FreeClust As Long, totClust As Longaa = GetDiskFreeSpace(Path, SecPerClust, BytePerSec, FreeClust, totClust)GetTotalSpace = SecPerClust * BytePerSec * totClustEnd Function(本文来源于图老师网站,更多请访问https://m.tulaoshi.com/bianchengyuyan/)