IWMPQuery::beginNextGroup 方法

[与此页面关联的功能(Windows 媒体播放器 SDK)是旧版功能。 它已被 MediaPlayer 取代。 MediaPlayer 已针对Windows 10和Windows 11进行了优化。 如果可能,Microsoft 强烈建议新代码使用 MediaPlayer 而不是 Windows 媒体播放器 SDK。 如果可能,Microsoft 建议重写使用旧 API 的现有代码以使用新 API。]

beginNextGroup 方法开始新的条件组。

语法

public void beginNextGroup();

Public Sub beginNextGroup()
Implements IWMPQuery.beginNextGroup

参数

此方法没有任何参数。

返回值

此方法不返回值。

备注

启动新的条件组意味着你已完成当前条件组。 新条件组始终使用 OR 逻辑连接到上一个条件组。

示例

以下示例通过合并两个包含条件的组来创建复杂查询。 查询结果将提取为字符串集合并显示在列表框中。 AxWMPLib.AxWindowsMediaPlayer 对象由名为 player 的变量表示。

// Get a new Query interface.
WMPLib.IWMPMediaCollection2 mc = (WMPLib.IWMPMediaCollection2)player.mediaCollection;
WMPLib.IWMPQuery q = mc.createQuery();

// Add a condition to the Query. 
q.addCondition("WM/Composer", "Equals", "Antonio Vivaldi");

// Begin another Query group.
q.beginNextGroup();

// Add a condition to the new group understanding that it will be combined with the
// first group using OR logic.
q.addCondition("Title", "Contains", "Capriol");

// Query the media collection and get a string collection containing the result.
// In this case, the string collection will contain the titles of all audio items that
// match the query.
WMPLib.IWMPStringCollection2 result = (WMPLib.IWMPStringCollection2)mc.getStringCollectionByQuery("Title", q, "audio", "", false);

// Display the results by adding them to a list box.
for (int i = 0; i < result.count; i++)
{
    complexQueryResults.Items.Add(result.Item(i));
}

' Get a new Query interface.
Dim mc As WMPLib.IWMPMediaCollection2 = player.mediaCollection
Dim q As WMPLib.IWMPQuery = mc.createQuery()

' Add a condition to the Query. 
q.addCondition("WM/Composer", "Equals", "Antonio Vivaldi")

' Begin another Query group.
q.beginNextGroup()

' Add a condition to the new group understanding that it will be combined with the
' first group using OR logic.
q.addCondition("Title", "Contains", "Capriol")

' Query the media collection and get a string collection containing the result.
' In this case, the string collection will contain the titles of all audio items that
' match the query.
Dim result As WMPLib.IWMPStringCollection2 = mc.getStringCollectionByQuery("Title", q, "audio", "", False)

' Display the results by adding them to a list box.
For i As Integer = 0 To (result.count - 1)

    complexQueryResults.Items.Add(result.Item(i))

Next i

要求

要求
版本
Windows 媒体播放器 11.
命名空间
WMPLib
程序集
Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

另请参阅

IWMPMediaCollection2.createQuery (VB 和 C#)

IWMPMediaCollection2.getPlaylistByQuery (VB 和 C#)

IWMPMediaCollection2.getStringCollectionByQuery (VB 和 C#)

IWMPQuery 接口 (VB 和 C#)