共用方式為


IWMDMStorage::GetSize

banner art

The GetSize method retrieves the size of the storage, in bytes.

Syntax

HRESULT GetSize(DWORD*pdwSizeLow,DWORD*pdwSizeHigh);

Parameters

pdwSizeLow

[out]  Pointer to a DWORD specifying the low-order part of the storage object size, in bytes.

pdwSizeHigh

[out]  Pointer to a DWORD specifying the high-order part of the storage object size, in bytes.

Return Values

The method returns an HRESULT. All the interface methods in Windows Media Device Manager can return any of the following classes of error codes:

  • Standard COM error codes
  • Windows error codes converted to HRESULT values
  • Windows Media Device Manager error codes

For an extenstive list of possible error codes, see Error Codes.

Possible values include, but are not limited to, those in the following table.

Return code Description
S_OK The method succeeded.
E_INVALIDARG A parameter is an invalid or NULL pointer.
E_FAIL An unspecified error occurred.
WMDM_E_NOTCERTIFIED The caller is not certified.

Remarks

For folders or abstract objects (such as abstract playlists), the size is zero.

Example Code

The following C++ code retrieves the size of a file, in kilobytes.

// Get size of file in kilobytes.
DWORD lowSize = 0;
DWORD highSize = 0;
hr = pStorage->GetSize(&lowSize, &highSize);
//TODO: Display the file size.

Requirements

Header: Defined in mswmdm.h.

Library: mssachlp.lib

See Also