Share via


AxWindowsMediaPlayer 개체의 CurrentPlaylistChange 이벤트

[이 페이지와 연결된 기능인 Windows 미디어 플레이어 SDK는 레거시 기능입니다. MediaPlayer로 대체되었습니다. MediaPlayer는 Windows 10 및 Windows 11 최적화되었습니다. 가능한 경우 새 코드에서 Windows 미디어 플레이어 SDK 대신 MediaPlayer를 사용하는 것이 좋습니다. 가능한 경우 레거시 API를 사용하는 기존 코드를 다시 작성하여 새 API를 사용하도록 제안합니다.]

CurrentPlaylistChange 이벤트는 현재 재생 목록 내에서 무언가가 변경되면 발생합니다.

[C#]
private void player_CurrentPlaylistChange(
  object sender,
  _WMPOCXEvents_CurrentPlaylistChangeEvent e
)

[Visual Basic]
Private Sub player_CurrentPlaylistChange(
  sender As Object,
  e As _WMPOCXEvents_CurrentPlaylistChangeEvent
) Handles player.CurrentPlaylistChange

이벤트 데이터

이 이벤트와 연결된 처리기는 AxWMPLib._WMPOCXEvents_CurrentPlaylistChangeEventHandler 형식입니다. 이 처리기는 이 이벤트와 관련된 다음 속성을 포함하는 AxWMPLib._WMPOCXEvents_CurrentPlaylistChangeEvent 형식의 인수를 받습니다.

속성 설명
변경 재생 목록에 발생한 변경 유형을 나타내는 WMPLib.WMPPlaylistChangeEventTypeAn 열거형 값입니다.

설명

이 이벤트는 다른 재생 목록이 현재 재생 목록이 될 때 발생하지 않습니다. 재생 목록에 추가되는 미디어 항목과 같이 현재 재생 목록 내에서 변경이 발생하는 경우에만 발생합니다.

예제

다음은 CurrentPlaylistChange 이벤트에 대한 응답으로 현재 재생 목록에 있는 모든 미디어 항목의 이름을 표시하는 예제입니다. AxWMPLib.AxWindowsMediaPlayer 개체는 player라는 변수로 표시됩니다.

// Add a delegate for the CurrentPlaylistChange event.
player.CurrentPlaylistChange += new AxWMPLib._WMPOCXEvents_CurrentPlaylistChangeEventHandler(player_CurrentPlaylistChange);  


private void player_CurrentPlaylistChange(object sender, AxWMPLib._WMPOCXEvents_CurrentPlaylistChangeEvent e)
{
    switch(e.change)
    {
        // Only update the list for the move, delete, insert, and append event types.
        case WMPLib.WMPPlaylistChangeEventType.wmplcMove:    // Value = 3
        case WMPLib.WMPPlaylistChangeEventType.wmplcDelete:  // Value = 4
        case WMPLib.WMPPlaylistChangeEventType.wmplcInsert:  // Value = 5
        case WMPLib.WMPPlaylistChangeEventType.wmplcAppend:  // Value = 6

        // Create a string array large enough to hold all of the media item names.
        int count = player.currentPlaylist.count;
        string[] mediaItems = new string[count];

        // Clear any previous contents of the text box.
        playlistItems.Clear();

        // Loop through the playlist and store each media item name.
        for (int i = 0; i < count; i++)
        {
            mediaItems[i] = player.currentPlaylist.get_Item(i).name;
        }

        // Display the media item names.
        playlistItems.Lines = mediaItems;
        break;
      
        default:
            break;
    }
}

Public Sub player_CurrentPlaylistChange(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_CurrentPlaylistChangeEvent) Handles player.CurrentPlaylistChange

    Select Case e.change

        &#39; Only update the list for the move, delete, insert, and append event types.
        Case WMPLib.WMPPlaylistChangeEventType.wmplcMove   &#39; Value = 3
        Case WMPLib.WMPPlaylistChangeEventType.wmplcDelete &#39; Value = 4
        Case WMPLib.WMPPlaylistChangeEventType.wmplcInsert &#39; Value = 5
        Case WMPLib.WMPPlaylistChangeEventType.wmplcAppend &#39; Value = 6

            &#39; Create a string array large enough to hold all of the media item names.
            Dim count As Integer = player.currentPlaylist.count
            Dim mediaItems(count) As String

            &#39; Clear any previous contents of the text box.
            playlistItems.Clear()

            &#39; Loop through the playlist and store each media item name.
            For i As Integer = 0 To (count - 1)

                mediaItems(i) = player.currentPlaylist.Item(i).name

            Next i

            &#39; Display the media item names.
            playlistItems.Lines = mediaItems
    End Select

End Sub

요구 사항

요구 사항
버전
Windows 미디어 플레이어 9 시리즈 이상
네임스페이스
AxWMPLib
어셈블리
AxInterop.WMPLib.dll(AxInterop.WMPLib.dll.dll)

추가 정보

AxWindowsMediaPlayer 개체(VB 및 C#)

AxWindowsMediaPlayer.currentPlaylist(VB 및 C#)

AxWindowsMediaPlayer.PlaylistChange 이벤트(VB 및 C#)

WMPPlaylistChangeEventType