IWMDMMetaData::QueryByName
The QueryByName method retrieves the value of a property by specifying its name.
Syntax
HRESULT QueryByName(
LPCWSTR pwszTagName,
WMDM_TAG_DATATYPE* pType,
BYTE** pValue,
UINT* pcbLength
);
Parameters
pwszTagName
[in] Pointer to a wide-character null-terminated string containing the name.
pType
[out] Pointer to a variable containing one member of the WMDM_TAG_DATATYPE enumeration type.
pValue
[out] Pointer to a pointer to a byte array that receives the content of the value if the method succeeds. The caller must free the memory through the CoTaskMemFree method.
pcbLength
[out] Pointer to the size, in bytes, of the byte array ppValue.
Return Values
The method returns an HRESULT. All the interface methods in Windows Media Device Manager and service provider 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 a complete list of possible error codes, see Error Codes.
Possible values include, but are not limited to, those in the following table.
Value | Description |
S_OK | The method succeeded. |
E_OUTOFMEMORY | There is not enough memory to allocate the item. |
E_INVALIDARG | One or more parameters are invalid. |
Example Code
// Assume that the parameter pMetaData is a valid IWMDMMetaData.
WMDM_TAG_DATATYPE type;
BYTE *value;
UINT size;
HRESULT hr;
// Get album information.
hr = pMetaData->QueryByName(g_wszWMDMAlbumTitle, &type, &value, &size);
if(SUCCEEDED(hr) && size)
{
// Do something with value and then free it.
CoTaskMemFree(value);
}
Requirements
Header: Defined in wmdm.idl.
Library: mssachlp.lib
See Also