Partager via


IWMPMediaCollection2::getPlaylistByQuery method

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The getPlaylistByQuery method returns an IWMPPlaylist interface that provides access to media items that match the query conditions.

Syntax

public IWMPPlaylist getPlaylistByQuery(
  IWMPQuery pQuery,
  System.String bstrMediaType,
  System.String bstrSortAttribute,
  System.Boolean fSortAscending
);

Public Function getPlaylistByQuery( _
  ByVal pQuery As IWMPQuery, _
  ByVal bstrMediaType As System.String, _
  ByVal bstrSortAttribute As System.String, _
  ByVal fSortAscending As System.Boolean _
) As IWMPPlaylist
Implements IWMPMediaCollection2.getPlaylistByQuery

Parameters

pQuery [in]

The WMPLib.IWMPQuery interface that represents the query.

bstrMediaType [in]

The System.String that is the media type. Must contain one of the following values: "audio", "video", "photo", "playlist", or "other".

bstrSortAttribute [in]

The System.String that is the attribute name used for sorting. A zero-length string ("") means no sorting is applied.

fSortAscending [in]

The System.Boolean value that indicates whether the playlist must be sorted in ascending order.

Return value

A WMPLib.IWMPPlaylist interface for the retrieved playlist.

Remarks

Compound queries using IWMPQuery are not case sensitive.

When the compound query specified by the pQuery parameter contains a condition built on the MediaType attribute, that condition is ignored. The value for the bstrMediaType parameter is always used. For example, if the compound query contains the condition "MediaType Equals audio" and the value for the bstrMediaType parameter is "video", the resulting playlist will contain only video items.

Requirements

Requirement Value
Version
Windows Media Player 11.
Namespace
WMPLib
Assembly
Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

See also

IWMPMediaCollection2 Interface (VB and C#)

IWMPPlaylist Interface (VB and C#)

IWMPQuery Interface (VB and C#)

MediaType Attribute