How To Use the GetDiskFreeSpaceEx() API to Obtain Disk Free Space Amounts (202455)
The information in this article applies to:
- Microsoft Visual Basic Learning Edition for Windows 5.0
- Microsoft Visual Basic Learning Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q202455 SUMMARY
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.
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 How To Find and View the Amount of Free Disk Space on a Drive
Modification Type: | Minor | Last Reviewed: | 7/13/2004 |
---|
Keywords: | kbAPI kbhowto KB202455 |
---|
|