# Re: 如何得知磁碟剩余空间

Posted by cww on February 08, 1998 at 17:40:39:

In Reply to: 如何得知磁碟剩余空间 posted by VB菜鸟 on February 08, 1998 at 02:43:33:

不用vb 所提供的stkit432.DLL的话可用以下方式(vb6 所提供的不是
srkit432.dll 而是vb6stkit.dll )

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

Dim aa As Long
Dim iSectors As Long, iByte As Long, iFree As Long, iTotal As Long

aa = GetDiskFreeSpace("c:", iSectors, iByte, iFree, iTotal)
'_________________^^^^

'更改成所需的磁碟代号
Label1.Caption = iSectors * iByte * iFree
Label2.Caption = iSectors * iByte * iTotal

Follow Ups: