GetDiskFreeSpaceEx
This code shows how to use GetFreeDiskSpaceEx API. It works with the drives larger than 2GB as oppose to the old GetFreeDiskSpace API call. It will also work with Windows2000 per-user space quota, so the free disk space you get is actually what available to the user and not all the space available on the disk.
AI
एआई सारांश: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
सोर्स कोड
Function GetFreeSpace(strPath as String) As Double Dim nFreeBytesToCaller As LargeInt Dim nTotalBytes As LargeInt Dim nTotalFreeBytes As LargeInt strPath = Trim(strPath) If Right(strPath, 1) <> "\" Then strPath = strPath & "\" End If If GetDiskFreeSpaceEx(strPath, nFreeBytesToCaller, nTotalBytes, nTotalFreeBytes) <> 0 Then GetFreeSpace = CULong( _ nFreeBytesToCaller.HiDWord.Byte1, _ nFreeBytesToCaller.HiDWord.Byte2, _ nFreeBytesToCaller.HiDWord.Byte3, _ nFreeBytesToCaller.HiDWord.Byte4) * 2 ^ 32 + _ CULong(nFreeBytesToCaller.LoDWord.Byte1, _ nFreeBytesToCaller.LoDWord.Byte2, _ nFreeBytesToCaller.LoDWord.Byte3, _ nFreeBytesToCaller.LoDWord.Byte4) End If End Function Function CULong(Byte1 As Byte, Byte2 As Byte, Byte3 As Byte, Byte4 As Byte) As Double CULong = Byte4 * 2 ^ 24 + Byte3 * 2 ^ 16 + Byte2 * 2 ^ 8 + Byte1 End Function
मूल टिप्पणियाँ (3)
Wayback Machine से पुनर्प्राप्त