delphi获取剩余磁盘空间

//单位MB

function getDiskFree(Drive: String): Int64;

var
 FreeBytes: Int64;
 TotalBytes: Int64;
begin
  if GetDiskFreeSpaceEx(Pchar(Drive),FreeBytes, TotalBytes, nil) then
  begin
  RESULT := FreeBytes;
  end
  else
  begin
   RESULT := 0;
  end;
  RESULT:=RESULT shr 20;
end;

你可能感兴趣的:(Delphi,磁盘空间)