Get drive information

 



Function FreeOnDrive ( Const Drive : Char ) : LongInt ;

Var

   lpRootPathName : PChar ;

   lpSectorsPerCluster : DWORD ;

   lpBytesPerSector : DWORD ;

   lpNumberOfFreeClusters : DWORD ;

   lpTotalNumberOfClusters : DWORD ;

Begin

   lpRootPathName := PChar ( Drive + ':\' ) ;

   If Windows.GetDiskFreeSpace ( lpRootPathName , lpSectorsPerCluster , lpBytesPerSector ,

      lpNumberOfFreeClusters , lpTotalNumberOfClusters ) Then

      Result := lpNumberOfFreeClusters * lpBytesPerSector * lpSectorsPerCluster

   Else

      Result := -1 ;

End ;

 

            Example :

       

                Caption := IntToStr ( FreeOnDrive ( 'c' ) ) ;


Back Home Foward