Share via


Windows Media Player 11 SDK IWMPMedia.markerCount (VB and C#) 

Windows Media Player SDK banner art

Previous Next

IWMPMedia.markerCount (VB and C#)

The markerCount property gets the number of markers in the media item.

[Visual Basic]
ReadOnly Property markerCount As Integer

[C#]
int markerCount {get;}

Property Value

A System.Int32 that is the marker count.

Remarks

This property returns zero if a file has no markers, or if the media item is not the same as the one specified in AxWindowsMediaPlayer.currentMedia.

Marker numbers start at 1.

Before using this property, you must have read access to the library. For more information, see Library Access.

Example Code

The following example uses markerCount to retrieve the number of markers in the current media item. That value is then used as the upper boundary for a looping structure, which iterates through the marker list to retrieve each marker name and display it in a multi-line text box. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

[Visual Basic]
' Get the number of markers in the current media item.
Dim mcount As Integer = player.currentMedia.markerCount

' Create an array to store the list of markers.
Dim markerNames(mcount) As String

' Verify that at least one marker exists in the current media item.
If (mcount > 0) Then

    ' Loop through the marker list.
    For i As Integer = 1 To mcount

        ' Store the marker name in the array.
        markerNames(i) = player.currentMedia.getMarkerName(i)

    Next i

    ' Display the marker names in the text box.
    markerList.Lines = markerNames

End If

FakePre-c702d217e3014dc28490be6996fa6310-84a4395132584cfb913b4eed87e79681

// 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;            
}

Requirements

Version: Windows Media Player 9 Series or later

Namespace: WMPLib

Assembly: Interop.WMPLib.dll (automatically generated by Visual Studio)

See Also

Previous Next