拿去用吧:)
GetDiskFreeSpace在硬盘超过3G左右就用不了了,所以还是用GetDiskFreeSpaceEx吧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
    
Declare Function GetDiskFreeSpaceEx Lib "kernel32" Alias "GetDiskFreeSpaceExA" (ByVal lpRootPathName _
       As String, lpFreeBytesAvailableToCaller As LARGE_INTEGER, lpTotalNumberOfBytes As LARGE_INTEGER, _
        lpTotalNumberOfFreeBytes As LARGE_INTEGER) As Long
        
 'This structure represents a 64-bit integer. The lowpart field is the
 'lower 32 bits of the integer and the highpart field is the upper 32 bits of the integer
Type LARGE_INTEGER ' 8 Bytes
Lowpart As Long
Highpart As Long
End Type
    Type VOLINFOSTRUCT
   VolumeName As String  '卷标名称,即label
   FATname As String     '文件系统名称
   VolSerial As Long     '卷序列号
   TotalSize As Double          '总容量,(字节)
   FreeSize As Double        '剩余空间,(字节)
   UsedSize As Double       '已用空间,(字节)
 End Type
Public Function GetVolInfo(ByVal Path As String) As VOLINFOSTRUCT
Dim volinfo As VOLINFOSTRUCT
Dim Ret1 As Long
Dim Ret2 As Long
Dim Maxlen As Long
Dim Vname As String
Dim fsysName As String
Dim VolSeri As Long
Dim SysFlag As Long
Dim FreeuserSize As LARGE_INTEGER '用于容纳调用者可用的字节数量
Dim FreeSize As LARGE_INTEGER '磁盘上可用的字节数
Dim TotSize As LARGE_INTEGER '磁盘上的总字节数
Vname = String(255, 0)
fsysName = String(255, 0)
Ret1 = GetVolumeInformation(Path, Vname, 256, VolSeri, Maxlen, _
   SysFlag, fsysName, 256)
Ret2 = GetDiskFreeSpaceEx(Path, FreeuserSize, TotSize, FreeSize)
Vname = Left(Vname, InStr(1, Vname, Chr(0)) - 1)
fsysName = Left(fsysName, InStr(1, fsysName, Chr(0)) - 1)    With volinfo
       '获得文件系统的名称
             .FATname = fsysName
              '获得卷标
             .VolumeName = Vname
              'VolSeri磁盘卷序列号
             .VolSerial = VolSeri
              '获得光盘总容量
             .TotalSize = ConvertSize(TotSize.Highpart, TotSize.Lowpart)
              '获得光盘剩余空间
             .FreeSize = ConvertSize(FreeSize.Highpart, FreeSize.Lowpart)
              '获得光盘已用空间
             .UsedSize = .TotalSize - .FreeSize
    End With
            
GetVolInfo = volinfo
End Function'这个函数emufiles模块也要用到
Public Function ConvertSize(ByVal Highpart As Long, ByVal Lowpart As Long) As Double
Dim Result As Double
'如果溢出
If Lowpart < 0 Then
Result = Highpart * 4294967296# + 4294967296# + Lowpart
Else
Result = Highpart * 4294967296# + Lowpart
End If
ConvertSize = Result
End Function