IWMPMedia :: getAttributeName, méthode
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 [ dans]
-
System. Int32 qui est l’index.
Valeur de retour
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 Windows Media, consultez la référence d’attribut.
Exemples
L’exemple suivant utilise getAttributeName pour remplir une zone de texte multiligne avec l’index et le nom de chaque attribut de l’élément multimédia en cours. L’objet AxWMPLib. AxWindowsMediaPlayer est représenté par la variable 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
Spécifications
| Condition requise | Valeur |
|---|---|
| Version |
Lecteur Windows Media série 9 ou version ultérieure |
| Espace de noms |
WMPLib |
| Assembly |
|