共用方式為


SHGetDiskFreeSpace function

Retrieves disk space information for a disk volume.

Syntax

BOOL SHGetDiskFreeSpace(
   LPCTSTR        pszVolume,
   ULARGE_INTEGER *pqwFreeCaller,
   ULARGE_INTEGER *pqwTot,
   ULARGE_INTEGER *pqwFree
);

Parameters

  • pszVolume
    Type: LPCTSTR

    A null-terminated string that specifies the volume for which size information is retrieved. This can be a drive letter, UNC name, or the path of a folder. You cannot use NULL to represent the current drive.

    When using Shell32.dll versions previous to version 5.0, this must be an ANSI string. Unicode is not supported in those versions.

  • pqwFreeCaller
    Type: ULARGE_INTEGER*

    The address of a ULARGE_INTEGER value that receives the number of bytes on the volume available to the calling application. If the operating system implements per-user quotas, this value may be less than the total number of free bytes on the volume.

  • pqwTot
    Type: ULARGE_INTEGER*

    The address of a ULARGE_INTEGER value that receives the total size of the volume, in bytes.

  • pqwFree
    Type: ULARGE_INTEGER*

    The address of a ULARGE_INTEGER value that receives the number of bytes of free space on the volume.

Return value

Type: BOOL

Returns TRUE if successful, FALSE otherwise.

Remarks

In Shell32.dll version 5.0 and later, SHGetDiskFreeSpace does not have its own implementation and is defined in Shellapi.h as shown here.

#define SHGetDiskFreeSpace SHGetDiskFreeSpaceEx

When you call SHGetDiskFreeSpace, you are actually calling SHGetDiskFreeSpaceEx.

This function calls the GetDiskFreeSpaceEx function if it is available on the operating system. If GetDiskFreeSpaceEx is not available, it is emulated by calling the GetDiskFreeSpace function and manipulating the return values. For additional information, see the documentation for GetDiskFreeSpaceEx.

Requirements

Minimum supported client

Windows 2000 Professional, Windows XP [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Shellapi.h

Library

Shell32.lib

DLL

Shell32.dll (version 4.71 or later)

See also

SHGetDiskFreeSpaceEx

GetDiskFreeSpaceEx