Menu

StSystem - GetDiskInfo

John Key
2003-04-03
2003-05-30
  • John Key

    John Key - 2003-04-03

    I am new to Systools and I am having trouble with the sample that is provide in the help for GetDiskInfo.  When I step through the code it complete skips the calculations for BytesPerCluster,DiskCapacity,etc. I'm not sure what I am doing wrong. Could someone give me a another example on how to use the function?  Any help would be greatly appreciated.

    Thanks

    John

    here's the sampel code I have.

    var
      BytesPerCluster,
      DiskCapacity,
      FreeSpace : Double;

      ClustersAvailable,
      TotalClusters,
      BytesPerSector,
      SectorsPerCluster : Cardinal;

    Begin
      if GetDiskInfo('c',ClustersAvailable,TotalClusters,BytesPersector,SectorsPerCluster) then
        begin
    ****Skips this part of the code*******   
    BytesPerCluster := SectorsPerCluster *     BytesPerSector;
        DiskCapacity := TotalClusters * BytesPerCluster;
        FreeSpace := ClustersAvailable * BytesPerCluster;
    ********************************
        end else
        ShowMessage(SysErrorMessage(GetLastError));

    end;

     
    • Tom Hahn

      Tom Hahn - 2003-04-04

      The code works fine. You must be getting an error of some kind which causes it to skip the lines that are processed when GetDiskInfo is true. Did you get an error message? Is there any reason you can't access the C drive?

      Regards,
      Tom

       
    • John Key

      John Key - 2003-04-04

      Thanks for the reply Tom.  I'm not aware of any errors, but I will double check.

      Thanks again,

      John

       
    • Anonymous

      Anonymous - 2003-05-30

      It is not a Systools problem.
      For the smart linker your code is doing nothing.
      The variables (local) are inaccesibles due to optimization.
      To bypass the problem, if you define global variables you are able to proceed step by step ...

      Regards,
      Maurizio

       

Log in to post a comment.