IWMPPlaylistCollection :: getByName, méthode
La méthode GetByName retourne une interface IWMPPlaylistArray qui fournit l’accès aux sélections portant le nom spécifié, le cas échéant.
Syntaxe
public IWMPPlaylistArray getByName(
System.String bstrName
);
Public Function getByName( _
ByVal bstrName As System.String _
) As IWMPPlaylistArray
Implements IWMPPlaylistCollection.getByName
Paramètres
-
bstrName [ dans]
-
System. String qui est le nom de la sélection.
Valeur de retour
Interface wmplib. IWMPPlaylistArray pour le tableau de sélections récupéré.
Notes
Utilisez IWMPPlaylistArray. Count pour déterminer si une sélection existe. Si Count est égal à zéro, le tableau est vide.
Avant d’appeler cette méthode, vous devez disposer d’un accès en lecture à la bibliothèque. Pour plus d’informations, consultez accès à la bibliothèque.
Exemples
L’exemple suivant utilise GetByName pour vérifier la collection de sélections pour une sélection nommée « favoris--4 et 5 étoiles évaluées ». Si une sélection de ce nom existe, GetByName la définit en tant que sélection actuelle. L’objet AxWMPLib. AxWindowsMediaPlayer est représenté par la variable Player.
// Get the count of the playlists named "Favorites -- 4 and 5 star rated".
int checkit = player.playlistCollection.getByName("Favorites -- 4 and 5 star rated").count;
// Since duplicate playlist names are allowed, the count returned
// will be either zero (no playlist) or greater than zero (playlist exists).
if (checkit > 0)
{
// Retrieve a playlist array containing "Favorites -- 4 and 5 star rated".
// Assume that there is only one playlist with that name, and assign it to the
// current playlist.
player.currentPlaylist = player.playlistCollection.getByName("Favorites -- 4 and 5 star rated").Item(0);
}
' Get the count of the playlists named "Favorites -- 4 and 5 star rated".
Dim checkit As Integer = player.playlistCollection.getByName("Favorites -- 4 and 5 star rated").count
' Since duplicate playlist names are allowed, the count returned
' will be either zero (no playlist) or greater than zero (playlist exists).
If (checkit > 0) Then
' Retrieve a playlist array object containing "Favorites -- 4 and 5 star rated".
' Assume that there is only one playlist with that name, and assign it to the
' current playlist.
player.currentPlaylist = player.playlistCollection.getByName("Favorites -- 4 and 5 star rated").Item(0)
End If
Spécifications
| Condition requise | Valeur |
|---|---|
| Version |
Lecteur Windows Media série 9 ou version ultérieure. |
| Espace de noms |
WMPLib |
| Assembly |
|