Group: File System - Library: kernel32
[Obsolete] Retrieves information about the specified disk, including the amount of free space on the disk.
Obtaining physical parameters for a drive: sectors, clusters, cylinders...
Disk in drive A:
Detecting changes in connections to removable drives (VFP9)
BOOL GetDiskFreeSpace(
LPCTSTR lpRootPathName, // root path
LPDWORD lpSectorsPerCluster, // sectors per cluster
LPDWORD lpBytesPerSector, // bytes per sector
LPDWORD lpNumberOfFreeClusters, // free clusters
LPDWORD lpTotalNumberOfClusters // total clusters
);
DECLARE SHORT GetDiskFreeSpace IN kernel32;
STRING lpRootPathName,;
INTEGER @ lpSectorsPerCluster,;
INTEGER @ lpBytesPerSector,;
INTEGER @ lpNumberOfFreeClusters,;
INTEGER @ lpTotalNumberOfClusters
lpRootPathName [in] Pointer to a null-terminated string that specifies the root directory of the disk to return information about.
lpSectorsPerCluster [out] Pointer to a variable for the number of sectors per cluster.
lpBytesPerSector [out] Pointer to a variable for the number of bytes per sector.
lpNumberOfFreeClusters [out] Pointer to a variable for the total number of free clusters on the disk that are available to the user associated with the calling thread.
If the function succeeds, the return value is nonzero.
The GetDiskFreeSpace function cannot report volume sizes that are greater than 2 GB. To ensure that your application works with large capacity hard drives, use the GetDiskFreeSpaceEx function.