IWMPMediaCollection::getByName 메서드
[이 페이지와 연결된 기능인 Windows 미디어 플레이어 SDK는 레거시 기능입니다. MediaPlayer로 대체되었습니다. MediaPlayer는 Windows 10 및 Windows 11 최적화되었습니다. 가능한 경우 새 코드에서 Windows 미디어 플레이어 SDK 대신 MediaPlayer를 사용하는 것이 좋습니다. 가능한 경우 레거시 API를 사용하는 기존 코드를 다시 작성하여 새 API를 사용하도록 제안합니다.]
메서드는 getByName
지정된 이름의 미디어 항목에 대한 액세스를 제공하는 IWMPPlaylist 인터페이스를 반환합니다.
구문
public IWMPPlaylist getByName(
System.String bstrName
);
Public Function getByName( _
ByVal bstrName As System.String _
) As IWMPPlaylist
Implements IWMPMediaCollection.getByName
매개 변수
-
bstrName [in]
-
지정된 이름인 System.String 입니다.
반환 값
검색된 미디어 항목에 대한 WMPLib.IWMPPlaylist 인터페이스입니다.
설명
이 메서드를 호출하기 전에 라이브러리에 대한 읽기 권한이 있어야 합니다. 자세한 내용은 라이브러리 액세스를 참조하세요.
IWMPMediaCollection 인터페이스를 검색하는 방법에는 두 가지가 있으며, 메서드의 getByName
동작은 사용하는 두 가지 방법에 따라 달라집니다. AxWindowsMediaPlayer.mediaCollection을 호출하여 인터페이스를 검색하는 경우 메서드는 getByName
라이브러리의 모든 미디어 항목을 반환합니다. 그러나 IWMPLibrary.mediaCollection을 호출하여 인터페이스를 검색하는 경우 메서드는 getByName
지정된 특성과 값이 있는 라이브러리의 오디오 항목만 반환합니다.
예제
다음 예제에서는 를 사용하여 getByName
라이브러리에서 세 개의 항목을 검색합니다. 그런 다음 각 항목이 현재 재생 목록에 추가됩니다. AxWMPLib.AxWindowsMediaPlayer 개체는 player라는 변수로 표시됩니다.
// In each case, use the name exactly as it appears in the library.
// Windows Media Player does not include file name extensions or file paths
// in the name. Internet URLs include the entire path, but not the
// file name extension.
// Get an interface to a playlist that contains an Internet URL.
WMPLib.IWMPPlaylist one = player.mediaCollection.getByName("https://www.proseware.com/Media/Laure");
// Get an interface to a playlist that contains a file on a network server.
WMPLib.IWMPPlaylist two = player.mediaCollection.getByName("Jeanne");
// Get an interface to a playlist that contains a file on a local drive.
WMPLib.IWMPPlaylist three = player.mediaCollection.getByName("house");
// Append each item to the current playlist. Since each playlist retrieved
// using getByName contains one digital media item, use the get_Item
// method with an index of zero to reference that item.
player.currentPlaylist.appendItem(one.get_Item(0));
player.currentPlaylist.appendItem(two.get_Item(0));
player.currentPlaylist.appendItem(three.get_Item(0));
' In each case, use the name exactly as it appears in the library.
' Windows Media Player does not include file name extensions or file paths
' in the name. Internet URLs include the entire path, but not the
' file name extension.
' Get an interface to a playlist that contains an Internet URL.
Dim one As WMPLib.IWMPPlaylist = player.mediaCollection.getByName("https://www.proseware.com/Media/Laure")
' Get an interface to a playlist that contains a file on a network server.
Dim two As WMPLib.IWMPPlaylist = player.mediaCollection.getByName("Jeanne")
' Get an interface to a playlist that contains a file on a local drive.
Dim three As WMPLib.IWMPPlaylist = player.mediaCollection.getByName("house")
' Append each item to the current playlist. Since each playlist retrieved
' using getByName contains one digital media item, use the Item
' property with an index of zero to reference that item.
player.currentPlaylist.appendItem(one.Item(0))
player.currentPlaylist.appendItem(two.Item(0))
player.currentPlaylist.appendItem(three.Item(0))
요구 사항
요구 사항 | 값 |
---|---|
버전 |
Windows 미디어 플레이어 9 시리즈 이상 |
네임스페이스 |
WMPLib |
어셈블리 |
|
추가 정보
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기