共用方式為


IWMPropertyVault::GetPropertyByIndex method (wmsdkidl.h)

[The feature associated with this page, Windows Media Format 11 SDK, is a legacy feature. It has been superseded by Source Reader and Sink Writer. Source Reader and Sink Writer have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Source Reader and Sink Writer instead of Windows Media Format 11 SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The GetPropertyByIndex method retrieves a property from the vault by its index value.

Syntax

HRESULT GetPropertyByIndex(
  [in]      DWORD             dwIndex,
  [out]     LPWSTR            pszName,
  [in, out] DWORD             *pdwNameLen,
  [out]     WMT_ATTR_DATATYPE *pType,
  [out]     BYTE              *pValue,
  [in, out] DWORD             *pdwSize
);

Parameters

[in] dwIndex

DWORD containing the property index.

[out] pszName

Pointer to a wide-character null-terminated string containing the name of the property.

[in, out] pdwNameLen

On input, a pointer to a DWORD containing the length, in wide characters, of the string at pszName. On output, specifies the number of characters, including the terminating null character, required to hold the property name.

[out] pType

Pointer to a member of the WMT_ATTR_DATATYPE enumeration type. This parameter specifies the type of data pointed to by pValue.

[out] pValue

Pointer to a data buffer containing the value of the property. This value can be one of several types. The type of data that the buffer contains on output is specified by the value of pType.

[in, out] pdwSize

Pointer to a DWORD containing the size, in bytes, of the data at pValue.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code Description
S_OK
The method succeeded.
E_INVALIDARG
pdwNameLen or pdwSize or pType is NULL.

OR

The index specified is not valid.

ASF_E_BUFFERTOOSMALL
One of the buffers (pszName or pValue) is not big enough to hold the property information.

Remarks

You must make two calls to GetPropertyByIndex to properly retrieve all of the information. On the first call, pass NULL for both pszName and pValue. When the call returns, pdwNameLen and pdwSize point to the correct sizes of their respective buffers. Then on the second call, pass properly sized buffers as pszName and pValue to receive the data.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only],Windows Media Format 9 Series SDK, or later versions of the SDK
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wmsdkidl.h (include Wmsdk.h)
Library Wmvcore.lib; WMStubDRM.lib (if you use DRM)

See also

IWMPropertyVault Interface

IWMPropertyVault::GetPropertyByName

IWMPropertyVault::SetProperty