WinAPI: GetDiskFreeSpaceEx - 获取磁盘容量信息


//声明:

GetDiskFreeSpaceEx(

  lpDirectoryName: PChar;                          {磁盘根路径}

  var lpFreeBytesAvailableToCaller: TLargeInteger; {可用空间}

  var lpTotalNumberOfBytes: TLargeInteger;         {总空间}

  TotalFree: PLargeInteger                         {剩余空间}

): BOOL;


 
   
//举例: procedure TForm1.FormCreate(Sender: TObject); var d1,d2,d3: Int64; begin GetDiskFreeSpaceEx('C:',d1,d2,@d3); Memo1.Clear; with Memo1.Lines do begin Add(Format('可用空间: %f GB',[d1/1024/1024/1024])); Add(Format('总空间: %f GB',[d2/1024/1024/1024])); Add(Format('剩余空间: %f GB',[d3/1024/1024/1024])); end; end;
//效果图:

你可能感兴趣的:(free)