IWMPCdromCollection :: Item, méthode
La méthode Item retourne une interface IWMPCdrom à l’index donné.
Syntaxe
public IWMPCdrom Item(
System.Int32 lIndex
);
Public Function Item( _
ByVal lIndex As System.Int32 _
) As IWMPCdrom
Implements IWMPCdromCollection.Item
Paramètres
-
Lindex [ dans]
-
System. Int32 qui est l’index.
Valeur de retour
Interface wmplib. IWMPCdrom .
Notes
Pour utiliser cette méthode, l’accès en lecture à la bibliothèque est requis. Pour plus d’informations, consultez accès à la bibliothèque.
Exemples
L’exemple suivant utilise Item pour afficher le spécificateur de lecteur et le nom de la sélection à partir de chaque CD disponible sur l’ordinateur dans une zone de liste. si le lecteur contient réellement du contenu DVD, Windows XP ou version ultérieure est requis. L’objet AxWMPLib. AxWindowsMediaPlayer est représenté par la variable Player.
// Store the number of available drives.
int numDrives = player.cdromCollection.count;
// Loop through the available drives.
for (int i = 0; i < numDrives; i++)
{
// Store the drive specifier and playlist name for this drive in a string.
string pl = player.cdromCollection.Item(i).driveSpecifier + " ";
pl += player.cdromCollection.Item(i).Playlist.name;
// Add the string to a list box.
myPlaylists.Items.Add(pl);
}
' Store the number of available drives.
Dim numDrives As Integer = player.cdromCollection.count
' Loop through the available drives.
For i As Integer = 0 To (numDrives - 1)
' Store the drive specifier and playlist name for this drive in a string.
Dim pl As String = player.cdromCollection.Item(i).driveSpecifier + " "
pl += player.cdromCollection.Item(i).Playlist.name
' Add the string to a list box.
myPlaylists.Items.Add(pl)
Next i
Spécifications
| Condition requise | Valeur |
|---|---|
| Version |
Lecteur Windows Media série 9 ou version ultérieure |
| Espace de noms |
WMPLib |
| Assembly |
|