共用方式為


IWMPropertyVault::GetPropertyByName 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 GetPropertyByName method retrieves a property from the vault by its name.

Syntax

HRESULT GetPropertyByName(
  [in]      LPCWSTR           pszName,
  [out]     WMT_ATTR_DATATYPE *pType,
  [out]     BYTE              *pValue,
  [in, out] DWORD             *pdwSize
);

Parameters

[in] pszName

Pointer to a null-terminated string containing the name of the property to be retrieved.

[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
pszName or pdwSize or pType is NULL.

OR

pszName contains an invalid property name.

ASF_E_BUFFERTOOSMALL
pdwSize specifies a size for pValue that is not large enough to hold the data.

Remarks

You must make two calls to GetPropertyByName to properly retrieve the value of the property. On the first call, pass NULL for pValue. When the call returns, pdwSize will point to the correct sizes of the buffer. Then on the second call, pass a properly sized buffer as 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::GetPropertyByIndex

IWMPropertyVault::SetProperty