共用方式為


AxWindowsMediaPlayer.currentPlaylist property

[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 currentPlaylist property gets or sets the current IWMPPlaylist interface that provides an easy way to organize and manipulate media items in a list.

Syntax

public IWMPPlaylist currentPlaylist {get; set;}

Public Property currentPlaylist As IWMPPlaylist

Property value

The WMPLib.IWMPPlaylist interface that provides access to the current playlist.

Remarks

If the IWMPSettings.autoStart property (also accessed via AxWindowsMediaPlayer.settings.autoStart) is true, playback begins automatically whenever you set currentPlaylist.

This property takes an IWMPPlaylist interface, which can be acquired in several ways, such as by getting the value from the IWMPPlaylistArray.Item or IWMPPlaylistCollection.newPlaylist properties. To load a playlist item using a file name, set the URL property or use AxWindowsMediaPlayer.newPlaylist.

Examples

The following example retrieves the first playlist in the library and uses the currentPlaylist property to set the retrieved playlist as the current playlist, and display its name. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

// Get an interface to the first playlist from the library. 
WMPLib.IWMPPlaylist firstPlaylist = player.playlistCollection.getAll().Item(0);

// Make the retrieved playlist the current playlist.
player.currentPlaylist = firstPlaylist;

// Display the name of the current playlist.
currentPlaylistLabel.Text = ("Found first playlist. Name = " + player.currentPlaylist.name);

' Get an interface to the first playlist from the library. 
Dim firstPlaylist As WMPLib.IWMPPlaylist = player.playlistCollection.getAll().Item(0)

' Make the retrieved playlist the current playlist.
player.currentPlaylist = firstPlaylist

' Display the name of the current playlist.
currentPlaylistLabel.Text = ("Found first playlist. Name = " + player.currentPlaylist.name)

Requirements

Requirement Value
Version
Windows Media Player 9 Series or later
Namespace
AxWMPLib
Assembly
AxInterop.WMPLib.dll (AxInterop.WMPLib.dll.dll)

See also

AxWindowsMediaPlayer Object (VB and C#)

AxWindowsMediaPlayer.newPlaylist (VB and C#)

AxWindowsMediaPlayer.settings (VB and C#)

IWMPPlaylist Interface (VB and C#)

IWMPPlaylistArray.Item (VB and C#)

IWMPPlaylistCollection.newPlaylist (VB and C#)

IWMPSettings.autoStart (VB and C#)