IWMPPlaylistCollection::getByName メソッド
[このページWindows メディア プレーヤー SDK に関連付けられている機能は、レガシ機能です。 MediaPlayer に置き換わりました。 MediaPlayer は、Windows 10とWindows 11用に最適化されています。 新しいコードでは、可能な場合は SDK ではなく MediaPlayerWindows メディア プレーヤー使用することを強くお勧めします。 Microsoft は、従来の API を使用する既存のコードを、可能であれば新しい API を使用するように書き直すよう提案しています。]
getByName メソッドは、指定した名前のプレイリスト (存在する場合) へのアクセスを提供する IWMPPlaylistArray インターフェイスを返します。
構文
public IWMPPlaylistArray getByName(
System.String bstrName
);
Public Function getByName( _
ByVal bstrName As System.String _
) As IWMPPlaylistArray
Implements IWMPPlaylistCollection.getByName
パラメーター
-
bstrName [in]
-
プレイリストの名前である System.String 。
戻り値
取得したプレイリスト配列の WMPLib.IWMPPlaylistArray インターフェイス。
解説
プレイリストが存在するかどうかを判断するには、 IWMPPlaylistArray.count を使用します。 count が 0 の場合、配列は空です。
このメソッドを呼び出す前に、ライブラリへの読み取りアクセス権が必要です。 詳細については、「 ライブラリ アクセス」を参照してください。
例
次の例では、getByName を使用して、"Favorites -- 4 および 5 star rated" という名前のプレイリストのプレイリスト コレクションをチェックします。 その名前のプレイリストが存在する場合は、 getByName によって現在のプレイリストとして設定されます。 AxWMPLib.AxWindowsMediaPlayer オブジェクトは、player という名前の変数によって表されます。
// Get the count of the playlists named "Favorites -- 4 and 5 star rated".
int checkit = player.playlistCollection.getByName("Favorites -- 4 and 5 star rated").count;
// Since duplicate playlist names are allowed, the count returned
// will be either zero (no playlist) or greater than zero (playlist exists).
if (checkit > 0)
{
// Retrieve a playlist array containing "Favorites -- 4 and 5 star rated".
// Assume that there is only one playlist with that name, and assign it to the
// current playlist.
player.currentPlaylist = player.playlistCollection.getByName("Favorites -- 4 and 5 star rated").Item(0);
}
' Get the count of the playlists named "Favorites -- 4 and 5 star rated".
Dim checkit As Integer = player.playlistCollection.getByName("Favorites -- 4 and 5 star rated").count
' Since duplicate playlist names are allowed, the count returned
' will be either zero (no playlist) or greater than zero (playlist exists).
If (checkit > 0) Then
' Retrieve a playlist array object containing "Favorites -- 4 and 5 star rated".
' Assume that there is only one playlist with that name, and assign it to the
' current playlist.
player.currentPlaylist = player.playlistCollection.getByName("Favorites -- 4 and 5 star rated").Item(0)
End If
要件
要件 | 値 |
---|---|
Version |
Windows メディア プレーヤー 9 シリーズ以降。 |
名前空間 |
WMPLib |
アセンブリ |
|
関連項目
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示