(Declarations)
Declare Private Function GetDiskFreeSpace Lib "Kernel32" Alias _
"GetDiskFreeSpaceA" (Byval lpRootPathName As String, lpSectorsPerCluster _
As Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, _
lpTotalNumberOfClusters As Long) As Long
(Click)
Dim drv As String
Dim ret As Long
Dim sectors As Long
Dim bytes As Long
Dim free As Long
Dim total As Long
drv = "C:\" 'Root directory for the drive to be checked
ret = GetDiskFreeSpace(drv, sectors, bytes, free, total)
Messagebox Cstr(sectors * bytes * free) & " bytes free on drive " & drv
Messagebox Cstr(sectors * bytes * total) & " total bytes on drive " & drv
Messagebox Cstr(sectors * bytes * (total - free)) & " bytes used on drive " & drv