共用方式為


IWMPMediaCollection2::getStringCollectionByQuery 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 getStringCollectionByQuery method returns an IWMPStringCollection interface that provides access to the set of all string values for a specified attribute that match the query conditions.

Syntax

public IWMPStringCollection getStringCollectionByQuery(
  System.String bstrAttribute,
  IWMPQuery pQuery,
  System.String bstrMediaType,
  System.String bstrSortAttribute,
  System.Boolean fSortAscending
);

Public Function getStringCollectionByQuery( _
  ByVal bstrAttribute As System.String, _
  ByVal pQuery As IWMPQuery, _
  ByVal bstrMediaType As System.String, _
  ByVal bstrSortAttribute As System.String, _
  ByVal fSortAscending As System.Boolean _
) As IWMPStringCollection
Implements IWMPMediaCollection2.getStringCollectionByQuery

Parameters

bstrAttribute [in]

The System.String that is the attribute name.

pQuery [in]

The WMPLib.IWMPQuery interface that is the query that defines the conditions used to retrieve the string collection.

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 set of string values must be sorted in ascending order.

Return value

A WMPLib.IWMPStringCollection interface for the retrieved set of string values.

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#)

IWMPQuery Interface (VB and C#)

IWMPStringCollection Interface (VB and C#)

MediaType Attribute