Méthode IWMPMedia::getAttributeName
[La fonctionnalité associée à cette page, Lecteur multimédia Windows SDK, est une fonctionnalité héritée. Il a été remplacé par MediaPlayer. MediaPlayer a été optimisé pour Windows 10 et Windows 11. Microsoft recommande vivement que le nouveau code utilise MediaPlayer au lieu de Lecteur multimédia Windows SDK, lorsque cela est possible. Microsoft suggère que le code existant qui utilise les API héritées soit réécrit pour utiliser les nouvelles API si possible.]
La méthode getAttributeName retourne le nom de l’attribut correspondant à l’index spécifié.
Syntaxe
public System.String getAttributeName(
System.Int32 lIndex
);
Public Function getAttributeName( _
ByVal lIndex As System.Int32 _
) As System.String
Implements IWMPMedia.getAttributeName
Paramètres
-
lIndex [in]
-
System.Int32 qui est l’index.
Valeur retournée
System.String qui est le nom de l’attribut.
Notes
Le nom d’attribut retourné peut être utilisé conjointement avec getItemInfo pour récupérer la valeur d’un attribut nommé spécifique.
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.
Pour plus d’informations sur les attributs pris en charge par Lecteur multimédia Windows, consultez référence des attributs.
Exemples
L’exemple suivant utilise getAttributeName pour remplir une zone de texte multiligne avec l’index et le nom de chaque attribut pour l’élément multimédia actif. L’objet AxWMPLib.AxWindowsMediaPlayer est représenté par la variable nommée player.
// Store an IWMPMedia3 interface for the current media item.
WMPLib.IWMPMedia3 cm = (WMPLib.IWMPMedia3)player.currentMedia;
// Get the number of attributes for the current media item.
int attCount = cm.attributeCount;
// Create an array of strings to hold the index and name for each attribute.
string[] attInfo = new string[attCount];
// Loop through the attribute list.
for (int i = 0; i < attCount; i++)
{
// Store the attribute index and name in the array.
attInfo[i] = ("Attribute " + i + ": " + cm.getAttributeName(i));
}
// Display the attribute information in the text box.
attributeNames.Lines = attInfo;
' Store an IWMPMedia3 interface for the current media item.
Dim cm As WMPLib.IWMPMedia3 = player.currentMedia
' Get the number of attributes for the current media.
Dim attCount As Integer = cm.attributeCount
' Create an array of strings to hold the index and name for each attribute.
Dim attInfo(attCount) As String
' Loop through the attribute list.
For i As Integer = 0 To (attCount - 1)
' Store the attribute index and name in the array.
attInfo(i) = ("Attribute " + i.ToString() + ": " + cm.getAttributeName(i))
Next i
' Display the attribute information in the text box.
attributeNames.Lines = attInfo
Configuration requise
Condition requise | Valeur |
---|---|
Version |
Lecteur multimédia Windows série 9 ou ultérieure |
Espace de noms |
WMPLib |
Assembly |
|
Voir aussi
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour