다음을 통해 공유


IWMPPlaylistCollection::newPlaylist method (wmp.h)

[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 newPlaylist method creates a new, empty playlist in the library.

Syntax

HRESULT newPlaylist(
  [in]  BSTR         bstrName,
  [out] IWMPPlaylist **ppItem
);

Parameters

[in] bstrName

String containing the name of the new playlist.

[out] ppItem

Pointer to a pointer to an IWMPPlaylist interface for the new playlist.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code Description
S_OK
The method succeeded.

Remarks

This method creates an empty playlist in the library. To fill the playlist with media items, use IWMPPlaylist::appendItem or IWMPPlaylist::insertItem.

Multiple playlists having the same name are permitted in the library. To avoid creating a duplicate playlist name with this method, use the getByName method and IWMPPlaylistArray::count to determine whether a playlist with a particular name already exists.

Leading and trailing spaces are not permitted in playlist names, and are automatically removed from the value specified for the bstrName parameter.

Before calling this method, you must have full access to the library. For more information, see Library Access.

Requirements

Requirement Value
Minimum supported client Windows Media Player 9 Series or later.
Target Platform Windows
Header wmp.h
DLL Wmp.dll

See also

IWMPPlaylist Interface

IWMPPlaylist::appendItem

IWMPPlaylist::insertItem

IWMPPlaylistArray::get_count

IWMPPlaylistCollection Interface

IWMPPlaylistCollection::getByName