Share via


Proprietà IWMPMedia::markerCount

[La funzionalità associata a questa pagina, Lettore multimediale Windows SDK, è una funzionalità legacy. È stata sostituita da MediaPlayer. MediaPlayer è stato ottimizzato per Windows 10 e Windows 11. Microsoft consiglia vivamente che il nuovo codice usi MediaPlayer anziché 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.

La proprietà markerCount ottiene il numero di marcatori nell'elemento multimediale.

Questa proprietà è di sola lettura.

Sintassi

public System.Int32 markerCount {get;}

Public ReadOnly Property markerCount As System.Int32

Valore proprietà

Oggetto System.Int32 che corrisponde al conteggio dei marcatori.

Commenti

Questa proprietà restituisce zero se un file non ha marcatori o se l'elemento multimediale non è uguale a quello specificato in AxWindowsMediaPlayer.currentMedia.

I numeri di marcatore iniziano a 1.

Prima di usare questa proprietà, è necessario avere accesso in lettura alla libreria. Per altre informazioni, vedere Accesso alla libreria.

Esempio

Nell'esempio seguente viene usato markerCount per recuperare il numero di marcatori nell'elemento multimediale corrente. Tale valore viene quindi usato come limite superiore per una struttura di ciclo, che esegue l'iterazione dell'elenco di marcatori per recuperare ogni nome di marcatore e visualizzarlo in una casella di testo a più righe. 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 markers.
string[] markerNames = new string[mcount];

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

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

' 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 markers.
Dim markerNames(mcount) As String

&#39; Verify that at least one marker exists in the current media item.
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.
        markerNames(i) = player.currentMedia.getMarkerName(i)

    Next i

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

End If

Requisiti

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

Vedi anche

AxWindowsMediaPlayer.currentMedia (VB e C#)

Interfaccia IWMPMedia (VB e C#)