|
disksize:=0;
for i:=99 to 122 do //'c'-'z';
begin
drive:=pchar(chr(i)+':\');
x:=GetDriveType(drive);
if x=3 then //3: The medium is a hard disk.
begin
GetDiskFreeSpaceEx(drive,userFreeBytes,totalBytes,@freeBytes);
k:=1000000000;
disksize:=totalBytes div k;
ListItem:=ListView1.Items.Add;
ListItem.Caption:=UpperCase(chr(i))+'drive';
ListItem.SubItems.Add(Formatfloat('###,##0',disksize)+'G');
end;
if x=2 then //removable
begin
GetDiskFreeSpaceEx(drive,userFreeBytes,totalBytes,@freeBytes);
disksize:=totalBytes div 1048576;
ListItem:=ListView1.Items.add;
ListItem.Caption:=UpperCase(chr(i))+'Removable Disk';
ListItem.SubItems.Add(inttostr(disksize)+'M');
end;
end; |
|