procedure GetDiskInfo(var TotalSize,FreeSize:Integer;Disk:string); //单位为兆(M)
var
freespace,totalspace:int64;
begin
if (Pos('\',TrimRight(Disk)<>Length(Disk) then
Disk :=Disk+'\';
GetDiskFreeSpaceEx(pchar(Disk),freespace,totalspace,nil);
TotalSize :=totalspace div 1024 div 1024;
freesize:=freespace div 1024 div 1024;
end;
//例如: GetDiskInfo(totalspace,freespace,'C:\');