//聲明:GetDiskFreeSpace(
lpRootPathName: PChar; {磁盤根路徑}
var lpSectorsPerCluster: DWORD; {一個簇內的扇區數}
var lpBytesPerSector: DWORD; {一個扇區內的字節數}
var lpNumberOfFreeClusters: DWORD; {剩余簇數}
var lpTotalNumberOfClusters: DWORD {總簇數}
): BOOL;
//舉例:
procedure TForm1.FormCreate(Sender: TObject);
var
d1,d2,d3,d4: DWORD;
begin
GetDiskFreeSpace('C:',d1,d2,d3,d4);
{以下只是顯示}
Memo1.Clear;
with Memo1.Lines do
begin
Add(Format('一個簇內的扇區數: %d',[d1]));
Add(Format('一個扇區內的字節數: %d',[d2]));
Add(Format('剩余簇數: %d',[d3]));
Add(Format('總簇數: %d',[d4]));
Add(Format('剩余空間: %f GB',[d3/1024/1024/1024*d2*d1]));
Add(Format('總空間: %f GB',[d4/1024/1024/1024*d2*d1]));
end;
end;
//效果圖: