Share via


Windows Media Player 11 SDK IWMPMediaCollection::getByAttribute 

Windows Media Player SDK banner art

Previous Next

IWMPMediaCollection::getByAttribute

The getByAttribute method retrieves a pointer to an IWMPPlaylist interface. This interface corresponds to the specified attribute having the specified value.

Syntax

  

Parameters

bstrAttribute

[in]  String containing the specified attribute.

bstrValue

[in]  String containing the specified value.

ppMediaItems

[out]  Pointer to a pointer to an IWMPPlaylist interface for the retrieved media items.

Return Values

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.

Remarks

This method can be used to create a generic query for media items that match a value for an attribute in the database. This is useful in the case of user-defined attributes. If the attribute does not exist, an error will result.

You can use this method to retrieve all of the media items of a specific type. Use the attribute name "MediaType" and one of the following values:

Value Description
audio Music and other audio-only items
other Other items, such as an .asf file or the URL of a stream.
photo Photo items. Requires Windows Media Player 10.
playlist Playlists represented as media items.
radio Radio station items. Not used by Windows Media Player 10.
video Video items.

Before calling this method, you must have read access to the library. For more information, see Library Access.

There are two ways you ways you can retrieve an IWMPMediaCollection interface, and the behavior of the getByAttribute method depends on which of those two ways you use. If you retrieve the interface by calling IWMPCore::get_mediaCollection, then the getByAttribute method returns all the media items in the library that have the specified attribute and value. If you retrieve the interface by calling IWMPLibrary::get_mediaCollection, then the getByAttribute method returns only the audio items in the library that have the specified attribute and value.

Requirements

Version: Windows Media Player 9 Series or later.

Header: Include wmp.h.

Library: Use wmp.dll.

See Also

Previous Next