Determine the maximum free disk space (Views: 2141)
Problem/Question/Abstract: I need a function to get the local disk with the maximum free space. Answer: uses Windows; { ... } var lpFreeBytesAvailableToCaller, lpTotalNumberOfBytes, lpTotalNumberOfFreeBytes: PLargeInteger; begin New(lpFreeBytesAvailableToCaller); New(lpTotalNumberOfBytes); New(lpTotalNumberOfFreeBytes); try GetDiskFreeSpaceEx('C:', lpFreeBytesAvailableToCaller, lpTotalNumberOfBytes, lpTotalNumberOfFreeBytes); finally Dispose(lpFreeBytesAvailableToCaller); Dispose(lpTotalNumberOfBytes); Dispose(lpTotalNumberOfFreeBytes); end; end; |