IWMPMedia :: getMarkerName, méthode

La méthode getMarkerName retourne le nom du marqueur à l’index spécifié.

Syntaxe

public System.String getMarkerName(
  System.Int32 MarkerNum
);

Public Function getMarkerName( _
  ByVal MarkerNum As System.Int32 _
) As System.String
Implements IWMPMedia.getMarkerName

Paramètres

MarkerNum [ dans]

System. Int32 qui est l’index du marqueur.

Valeur de retour

System. String qui est le nom du marqueur.

Notes

Cette méthode retourne la valeur null si le marqueur spécifié n’existe pas.

Certains éléments multimédias ne contiennent pas de marqueurs. Utilisez markerCount pour déterminer le nombre de marqueurs qui se trouvent dans l’élément multimédia en cours.

Les numéros d’index des marqueurs commencent à 1.

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 de code suivant utilise getMarkerName pour remplir une zone de texte multiligne avec les noms des marqueurs dans l’élément multimédia en cours. L’objet AxWMPLib. AxWindowsMediaPlayer est représenté par la variable Player.

// Get the number of markers in the current media item.
int mcount = player.currentMedia.markerCount;

// Create an array to store the list of marker names
string[] markers = new string[mcount];

// Verify that at least one marker exists in the current media.
if (mcount > 0)
{
    // Loop through the marker list.
    for (int i = 1; i < mcount + 1; i++)
    {
        // Store the marker name in the array.
        markers[i] = player.currentMedia.getMarkerName(i);
    }

    // Display the marker names in the text box.
    markerNames.Lines = markers;
}

' Get the number of markers in the current media item.
Dim mCount As Integer = player.currentMedia.markerCount

&#39; Create an array to store the list of marker names
Dim markers(mCount) As String

&#39; Verify that at least one marker exists in the current media.
If (mCount > 0) Then

    &#39; Loop through the marker list.
    For i As Integer = 1 To mCount

        &#39; Store the marker name in the array.
        markers(i) = player.currentMedia.getMarkerName(i)

    Next i

End If

&#39; Display the marker names in the text box.
markerNames.Lines = markers

Spécifications

Condition requise Valeur
Version
Lecteur Windows Media série 9 ou version ultérieure
Espace de noms
WMPLib
Assembly
Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

Voir aussi

Interface IWMPMedia (VB et C#)

IWMPMedia. markerCount (VB et C#)