function GetDiskSize(drive: Char; var free_size, total_size: Int64): Boolean;
var
RootPath: array[0..4] of Char;
RootPtr: PChar;
current_dir: string;
begin
RootPath[0] := Drive;
RootPath[1] := ':';
RootPath[2] := '\';
RootPath[3] := #0;
RootPtr := RootPath;
current_dir := GetCurrentDir;
if SetCurrentDir(drive + ':\') then
begin
GetDiskFreeSpaceEx(RootPtr, Free_size, Total_size, nil);
SetCurrentDir(current_dir);
Result := True;
end
else
begin
Result := False;
Free_size := -1;
Total_size := -1;
end;
end;
var
drv : String;
SectPerCls,
BytesPerCls,
FreeCls,
TotCls : DWord;
begin
drv := 'C:\';
GetDiskFreeSpace(PChar(drv), SectPerCls, BytesPerCls, FreeCls, TotCls);
Label11.Caption := FormatFloat('0.00', (SectPerCls * BytesPerCls *
TotCls)/1000000) + ' MB';
Label12.Caption := FormatFloat('0.00', (SectPerCls * BytesPerCls *
FreeCls)/1000000) + ' MB';
end;