Article ID: 202455 - Last Review: July 13, 2004 - Revision: 2.1 How To Use the GetDiskFreeSpaceEx() API to Obtain Disk Free Space AmountsThis article was previously published under Q202455 On This PageSUMMARY
The Win32 API function GetDiskFreeSpace reports the amount of total and free disk space available on a computer. However, for disks that are larger than 2 gigabytes, the GetDiskFreeSpace function may return misleading values. The new GetDiskFreeSpaceEx Win32 API function returns correct values for all disks, including those that are larger than 2 GB. GetDiskFreeSpaceEx returns values for the total amount of space, the total amount of free space, and the total amount of free space available to the user associated with the calling thread. This article provides sample code that uses this new function to obtain disk space information for any disk. MORE INFORMATIONGetDiskFreeSpaceEx is supported on Windows NT 4.0 or later and Windows 95 OSR2 or later. It is not supported on Windows CE. Your code can determine whether the GetDiskFreeSpaceEx function is available by checking to see if it is exported by Kernel32. For additional information, see the "Remarks" section for GetDiskFreeSpaceEx in the MSDN Library.
Example of How to Get Disk Space Information by Using GetDiskFreeSpaceEx
REFERENCES
MSDN Library; Platform SDK; Base Services; Files and I/O; File I/O; File I/O Reference; File I/O Functions; GetDiskFreeSpace MSDN Library; Platform SDK; Base Services; Files and I/O; File I/O; File I/O Reference; File I/O Functions; GetDiskFreeSpaceEx For additional information, click the article number below to view the article in the Microsoft Knowledge Base: 153091
(http://support.microsoft.com/kb/153091/EN-US/
)
How To Find and View the Amount of Free Disk Space on a Drive
APPLIES TO
| Article Translations
|
Back to the top
