IWMDMMetaData::AddItem
The AddItem method adds a metadata property.
Syntax
HRESULT AddItem(
WMDM_TAG_DATATYPE Type,
LPCWSTR pwszTagName,
BYTE* pValue,
UINT iLength
);
Parameters
Type
[in] Specifies the type of metadata value. It is a member of the WMDM_TAG_DATATYPE enumeration type.
pwszTagName
[in] Pointer to a wide-character null-terminated string containing the name portion of the name/value pair.
pValue
[in] Pointer to a byte array containing the value.
iLength
[in] Integer containing the size, in bytes, of pValue.
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.
WCHAR Name[] = L"Property Name";
HRESULT hr = pMetaData->AddItem(WMDM_TYPE_STRING,
g_wszWMDMTitle,
(BYTE *)Name,
sizeof(Name)
);
Requirements
Header: Defined in wmdm.idl.
Library: mssachlp.lib
See Also