共用方式為


MediaCollection.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 retrieves a StringCollection object containing all strings that match the query conditions.

Syntax

retVal = MediaCollection.getStringCollectionByQuery(
  attribute,
  query,
  mediaType,
  sortAttribute,
  sortAscending
)

Parameters

attribute [in]

String containing the attribute name.

query [in]

Query object.

mediaType [in]

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

sortAttribute [in]

String containing the attribute name used for sorting. An empty string ("") means no sorting is applied.

sortAscending [in]

Boolean, true indicating that the StringCollection must be sorted in ascending order.

Return value

This method returns a StringCollection object.

Remarks

Compound queries using Query are not case sensitive.

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

Requirements

Requirement Value
Version
Windows Media Player 11.
DLL
Wmp.dll

See also

MediaCollection Object

MediaType Attribute

Query Object