1个回答
展开全部
function GetFreeDiskSpace(const Drive : Char) : LongInt;var lpRootPathName : PChar; // address of root path lpSectorsPerCluster : DWORD; // address of sectors per cluster lpBytesPerSector : DWORD; // address of bytes per sector lpNumberOfFreeClusters : DWORD; // address of number of free clusters lpTotalNumberOfClusters : DWORD; // address of total number of clustersbegin lpRootPathName PChar( Drive + ':\' ); if Windows.GetDiskFreeSpace( lpRootPathName, lpSectorsPerCluster, lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters ) then Result lpNumberOfFreeClusters * lpBytesPerSector * lpSectorsPerCluster else Result -1;end;使用时var nSize: LongInt;begin nSize GetFreeDiskSpace('C');end;结果的单位为Byte,自己再计算成所要的单位就行了 查看更多答案>>
采纳哦
采纳哦
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询