Share via


IWMDMStorage3::SetMetadata (deprecated)

banner art

This is preliminary documentation and subject to change.

This topic documents a feature of the Windows Media Device Manager SDK. We recommend that you migrate your application to use the Windows Portable Devices API. For more information, see the Windows Portable Devices SDK.

The SetMetadata method sets metadata on the storage.

Syntax

HRESULT SetMetadata(
  IWMDMMetaData*  pMetadata
);

Parameters

pMetadata

[in]  An IWMDMMetaData pointer containing metadata to set on the object. To create this interface, call CreateEmptyMetadataObject.

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. If it fails with an error, it returns a standard error code.

Return code Description
S_OK The method succeeded.
WMDM_S_NOT_ALL_PROPERTIES_APPLIED Not all the requested properties could be applied.

Remarks

Existing properties in the storage with the same name are overwritten. All other existing properties are not modified or lost.

To set properties for a Windows Portable Devices (WPD) device, an application would create an IPortableDeviceValues object and set each property into this collection. Then, the application would serialize the collection to a binary large object (BLOB). Once the data is serialized, the application would add it to the IWMDMMetaData referenced by the pMetadata argument using the g_wszWPDPassthroughPropertyValues metadata constant.

Example Code

The following C++ code adds a subtitle as metadata to a storage (pStorage3) using the IWMDMMetaData interface retrieved from the storage previously (not shown).

// Set metadata values on a storage.
WCHAR* station = L"Mysubtitle";
UINT numBytes = (wcslen(station) + 1) * sizeof(WCHAR); // WCHAR string is 2 * length of characters long
                                                       // plus the terminating null character.
hr = pMetadata->AddItem(WMDM_TYPE_STRING, g_wszWMDMMediaStationName, (BYTE*)station, numBytes) ;
BREAK_HR(hr, "Added a metadata value to the interface in TestUpdateMetadata.", "Couldn't add a metadata value to the interface in TestUpdateMetadata.");

// Add the metadata to the storage.
hr = pStorage3->SetMetadata(pMetadata);
BREAK_HR(hr, "Set metadata on the storage in TestUpdateMetadata.", "Couldn't set metadata on the storage in TestUpdateMetadata: " << hex << hr << dec);

Requirements

Header: Defined in mswmdm.h.

Library: mssachlp.lib

See Also