> declare short GetDiskFreeSpaceEx in Win32API ; > string @lpDirectoryName, string @lpFreeBytesAvailableToCaller, ; > string @lpTotalNumberOfBytes, string @lpTotalNumberOfFreeBytes > store replicate(chr(0), 8) to lcCaller, lcTotal, lcFree > if GetDiskFreeSpaceEx(@lcDir, @lcCaller, @lcTotal, @lcFree) 0 >68 lnResult = Hex2Decimal(iif(tlTotal, lcTotal, lcFree)) > endif GetDiskFreeSpaceEx(@lcDir, ...
>68 lnResult = .Hex2Decimal(iif(tlTotal, lcTotal, lcFree))
>
>
>
>What happens is the program crashes in the middle of a re-index and my indexes are lost. (Yuck)
Deamon,
As you can probably tell the routine is retrieving the total or free amount of diskspace. The function Hex2Decimal simply takes a string representing the value (which is stored in a string because it's a 64 bit integer and VFP can't handle that size) and converts it (it's in LSB to MSB format). I don't know exactly how Doug's code accomplishes it, but it's no doubt the same way I do. Now the reason that he's doing this is that VFP's functions to retrieve these values call functions that cap the value at 2 gb and, therefore, are unreliable. You can see how I make this conversion in my FAQ "Workaround for SYS(2020)/DISKSPACE() bug" which uses the function shown above.