function GetDiskInfo(Driver:String): TDiskInfo;<br>var<br> DriveType : integer;<br> lpFreeBytesAvailableToCaller : int64;<br> lpTotalNumberOfBytes : int64;<br> lpTotalNumberOfFreeBytes : TLargeInteger ;<br> DiskAllSpace : Integer;<br> DiskFreeSpace : Integer;<br> DiskUseSpace : Integer;<br>begin<br> DiskAllSpace := 0;<br> DiskFreeSpace := 0;<br> DiskUseSpace := 0;<br> try<br> DriveType:=GetDriveType(pchar(Driver+'/'));<br> case DriveType of<br> DRIVE_FIXED,DRIVE_CDROM,DRIVE_REMOVABLE,DRIVE_REMOTE :<br> begin<br> if GetDiskFreeSpaceEx(pchar(String(Driver)+'/')<br> ,lpFreeBytesAvailableToCaller<br> ,lpTotalNumberOfBytes<br> , @lpTotalNumberOfFreeBytes) then<br> begin<br> DiskAllSpace := lpTotalNumberOfBytes Div (1024*1024);<br> DiskFreeSpace := lpFreeBytesAvailableToCaller Div (1024*1024);<br> DiskUseSpace := DiskAllSpace-DiskFreeSpace;<br> end;<br> end;<br> end;<br> except<br> on E: Exception do showmessage('GetDiskInfo'+E.Message);<br> end;<br> Result.DiskAllSpace := DiskAllSpace;<br> Result.DiskFreeSpace := DiskFreeSpace;<br> Result.DiskUseSpace := DiskUseSpace;<br>end;