VBGood网站全文搜索 Google

搜索VBGood全站网页(全文搜索)
首页 - 经验之谈 - 取得Disk Free Space与Total Space
发表评论(0)作者:不详, 平台:VB6.0+Win98, 阅读:8932, 日期:2001-09-16
取得Disk Free Space与Total Space


作者: cww 

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 Long
Dim aa As Long
Dim Path As String
Dim SecPerClust As Long
Dim BytePerSec As Long, FreeClust As Long, totClust As Long
Path = "c:\" 注释:指定Volume 代号, 如: c:\  d:\  e:\
aa = GetDiskFreeSpace(Path, SecPerClust, BytePerSec, FreeClust, totClust)
GetFreeSpace = SecPerClust * BytePerSec * FreeClust

End Function

注释:Path = "c:\"  指定Volume 代号, 如: c:\  d:\  e:\
Public Function GetTotalSpace(Byval Path as String) as Long
Dim aa As Long
Dim Path As String
Dim SecPerClust As Long
Dim BytePerSec As Long, FreeClust As Long, totClust As Long
aa = GetDiskFreeSpace(Path, SecPerClust, BytePerSec, FreeClust, totClust)
GetTotalSpace = SecPerClust * BytePerSec * totClust

End Function