Share via


Metodo IWMPMedia::getMarkerName

[La funzionalità associata a questa pagina, Lettore multimediale Windows SDK, è una funzionalità legacy. È stato sostituito da MediaPlayer. MediaPlayer è stato ottimizzato per Windows 10 e Windows 11. Microsoft consiglia vivamente che il nuovo codice usi MediaPlayer invece di Lettore multimediale Windows SDK, quando possibile. Microsoft suggerisce che il codice esistente che usa le API legacy venga riscritto per usare le nuove API, se possibile.

Il metodo getMarkerName restituisce il nome del marcatore in corrispondenza dell'indice specificato.

Sintassi

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

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

Parametri

MarkerNum [in]

Oggetto System.Int32 che rappresenta l'indice dell'indicatore.

Valore restituito

Oggetto System.String che rappresenta il nome del marcatore.

Commenti

Questo metodo restituisce NULL se il marcatore specificato non esiste.

Alcuni elementi multimediali non contengono marcatori. Usare markerCount per scoprire quanti marcatori si trovano nell'elemento multimediale corrente.

I numeri di indice marcatori iniziano da 1.

Prima di chiamare questo metodo, è necessario disporre dell'accesso in lettura alla libreria. Per altre informazioni, vedere Accesso alla libreria.

Esempio

Nell'esempio di codice seguente viene usato getMarkerName per riempire una casella di testo a più righe con i nomi dei marcatori nell'elemento multimediale corrente. L'oggetto AxWMPLib.AxWindowsMediaPlayer è rappresentato dalla variabile denominata 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

Requisiti

Requisito Valore
Versione
Lettore multimediale Windows serie 9 o successive
Spazio dei nomi
WMPLib
Assembly
Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

Vedi anche

Interfaccia IWMPMedia (VB e C#)

IWMPMedia.markerCount (VB e C#)