[TUVGM ] - [ Qui sait utiliser le contrôle WindowsMediaPlayer ? ]
1 réponse
The Ultimate Video Game Museum
Hello,
Est-ce que quelqu'un sait se servir du contrôle WindowsMediaPlayer (wmp.dll)
?
Attention je ne parle pas de MediaPlayer (msdxm.ocx).
J'essaye en fait de créer et utiliser la Playlist de ce contrôle pour avoir
à éviter de gérer ça moi-même.
Ce contrôle est très mal documenté au niveau de Visual Basic.
J'ai tenté d'adapter les codes prévus pour C++ ce qui donne le code suivant
:
----------------------------------------------------------------------
Function PlayList_Initialisation()
' Crée une nouvelle PlayList.
WindowsMediaPlayer_Audio.playlistCollection.newPlaylist ("0")
//////////// ici la Playlist est bien créée. Je la retrouve même en
démarrant Windows Media Player.
//////////// la Playlist porte ici le nom "0" mais ça n'a pas d'importance
dans l'état actuel des choses.
End Function
----------------------------------------------------------------------
----------------------------------------------------------------------
Function PlayList_Ajout(Index As Integer, Media As Variant)
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
François Picalausa
Bonjour/soir,
Place 5 boutons de commande sur la feuille (command1 à command5), une listbox (list1) et un contrôle WMP (WindowsMediaPlayer1) Ensuite, place ce code dans la feuille: Option Explicit
Private Sub Command1_Click() Dim i As Long
List1.Clear For i = 0 To WindowsMediaPlayer1.playlistCollection.getAll.Count - 1 List1.AddItem WindowsMediaPlayer1.playlistCollection.getAll.Item(i).Name Next i End Sub
Private Sub Command2_Click() Dim i As Long
List1.Clear For i = 0 To WindowsMediaPlayer1.currentPlaylist.Count - 1 List1.AddItem WindowsMediaPlayer1.currentPlaylist.Item(i).Name Next i End Sub
Private Sub Command3_Click() WindowsMediaPlayer1.URL = "file://c:windowsmediacanyon.mid" End Sub
Private Sub Command4_Click() WindowsMediaPlayer1.currentPlaylist.appendItem WindowsMediaPlayer1.newMedia("file://c:windowsmediacanyon.mid") End Sub
Private Sub Command5_Click() WindowsMediaPlayer1.currentPlaylist.RemoveItem WindowsMediaPlayer1.currentPlaylist.Item(List1.ListIndex) Command2_Click End Sub
Private Sub Form_Load() Command1.Caption = "Lister les Playlists" Command2.Caption = "Lister le contenu de la playlist actuelle" Command3.Caption = "Charger un fichier" Command4.Caption = "Ajouter un fichier à la playlist actuelle" Command5.Caption = "Supprimer de la playlist actuelle" End Sub
Pour informations, tout le modèle objet de Windows Media Player est listé dans le Microsoft Windows Media Player 9 SDK: http://msdn.microsoft.com/library/en-us/wmplay/mmp_sdk/windowsmediaplayer9seriessdk.asp ou, pour l'obtenir offline: http://msdn.microsoft.com/library/default.asp?url=/downloads/list/winmedia.asp et http://www.microsoft.com/downloads/details.aspx?FamilyIDä3cbe59-678a-458a-86a7-ff1716fad02f&DisplayLang=en
"The Ultimate Video Game Museum" a écrit dans le message de news:3f759004$0$27594$
Hello,
Est-ce que quelqu'un sait se servir du contrôle WindowsMediaPlayer (wmp.dll) ? Attention je ne parle pas de MediaPlayer (msdxm.ocx).
J'essaye en fait de créer et utiliser la Playlist de ce contrôle pour avoir à éviter de gérer ça moi-même. Ce contrôle est très mal documenté au niveau de Visual Basic. J'ai tenté d'adapter les codes prévus pour C++ ce qui donne le code suivant
---------------------------------------------------------------------- Function PlayList_Initialisation()
' Crée une nouvelle PlayList. WindowsMediaPlayer_Audio.playlistCollection.newPlaylist ("0")
//////////// ici la Playlist est bien créée. Je la retrouve même en démarrant Windows Media Player. //////////// la Playlist porte ici le nom "0" mais ça n'a pas d'importance dans l'état actuel des choses.
End Function ----------------------------------------------------------------------
---------------------------------------------------------------------- Function PlayList_Ajout(Index As Integer, Media As Variant)
End Function ----------------------------------------------------------------------
Bonjour/soir,
Place 5 boutons de commande sur la feuille (command1 à command5), une
listbox (list1) et un contrôle WMP (WindowsMediaPlayer1)
Ensuite, place ce code dans la feuille:
Option Explicit
Private Sub Command1_Click()
Dim i As Long
List1.Clear
For i = 0 To WindowsMediaPlayer1.playlistCollection.getAll.Count - 1
List1.AddItem
WindowsMediaPlayer1.playlistCollection.getAll.Item(i).Name
Next i
End Sub
Private Sub Command2_Click()
Dim i As Long
List1.Clear
For i = 0 To WindowsMediaPlayer1.currentPlaylist.Count - 1
List1.AddItem WindowsMediaPlayer1.currentPlaylist.Item(i).Name
Next i
End Sub
Private Sub Command3_Click()
WindowsMediaPlayer1.URL = "file://c:windowsmediacanyon.mid"
End Sub
Private Sub Command4_Click()
WindowsMediaPlayer1.currentPlaylist.appendItem
WindowsMediaPlayer1.newMedia("file://c:windowsmediacanyon.mid")
End Sub
Private Sub Command5_Click()
WindowsMediaPlayer1.currentPlaylist.RemoveItem
WindowsMediaPlayer1.currentPlaylist.Item(List1.ListIndex)
Command2_Click
End Sub
Private Sub Form_Load()
Command1.Caption = "Lister les Playlists"
Command2.Caption = "Lister le contenu de la playlist actuelle"
Command3.Caption = "Charger un fichier"
Command4.Caption = "Ajouter un fichier à la playlist actuelle"
Command5.Caption = "Supprimer de la playlist actuelle"
End Sub
Pour informations, tout le modèle objet de Windows Media Player est listé
dans le Microsoft Windows Media Player 9 SDK:
http://msdn.microsoft.com/library/en-us/wmplay/mmp_sdk/windowsmediaplayer9seriessdk.asp
ou, pour l'obtenir offline:
http://msdn.microsoft.com/library/default.asp?url=/downloads/list/winmedia.asp
et
http://www.microsoft.com/downloads/details.aspx?FamilyIDä3cbe59-678a-458a-86a7-ff1716fad02f&DisplayLang=en
"The Ultimate Video Game Museum" <tuvgm@online.fr> a écrit dans le
message de news:3f759004$0$27594$626a54ce@news.free.fr
Hello,
Est-ce que quelqu'un sait se servir du contrôle WindowsMediaPlayer
(wmp.dll) ?
Attention je ne parle pas de MediaPlayer (msdxm.ocx).
J'essaye en fait de créer et utiliser la Playlist de ce contrôle pour
avoir à éviter de gérer ça moi-même.
Ce contrôle est très mal documenté au niveau de Visual Basic.
J'ai tenté d'adapter les codes prévus pour C++ ce qui donne le code
suivant
----------------------------------------------------------------------
Function PlayList_Initialisation()
' Crée une nouvelle PlayList.
WindowsMediaPlayer_Audio.playlistCollection.newPlaylist ("0")
//////////// ici la Playlist est bien créée. Je la retrouve même en
démarrant Windows Media Player.
//////////// la Playlist porte ici le nom "0" mais ça n'a pas
d'importance dans l'état actuel des choses.
End Function
----------------------------------------------------------------------
----------------------------------------------------------------------
Function PlayList_Ajout(Index As Integer, Media As Variant)
Place 5 boutons de commande sur la feuille (command1 à command5), une listbox (list1) et un contrôle WMP (WindowsMediaPlayer1) Ensuite, place ce code dans la feuille: Option Explicit
Private Sub Command1_Click() Dim i As Long
List1.Clear For i = 0 To WindowsMediaPlayer1.playlistCollection.getAll.Count - 1 List1.AddItem WindowsMediaPlayer1.playlistCollection.getAll.Item(i).Name Next i End Sub
Private Sub Command2_Click() Dim i As Long
List1.Clear For i = 0 To WindowsMediaPlayer1.currentPlaylist.Count - 1 List1.AddItem WindowsMediaPlayer1.currentPlaylist.Item(i).Name Next i End Sub
Private Sub Command3_Click() WindowsMediaPlayer1.URL = "file://c:windowsmediacanyon.mid" End Sub
Private Sub Command4_Click() WindowsMediaPlayer1.currentPlaylist.appendItem WindowsMediaPlayer1.newMedia("file://c:windowsmediacanyon.mid") End Sub
Private Sub Command5_Click() WindowsMediaPlayer1.currentPlaylist.RemoveItem WindowsMediaPlayer1.currentPlaylist.Item(List1.ListIndex) Command2_Click End Sub
Private Sub Form_Load() Command1.Caption = "Lister les Playlists" Command2.Caption = "Lister le contenu de la playlist actuelle" Command3.Caption = "Charger un fichier" Command4.Caption = "Ajouter un fichier à la playlist actuelle" Command5.Caption = "Supprimer de la playlist actuelle" End Sub
Pour informations, tout le modèle objet de Windows Media Player est listé dans le Microsoft Windows Media Player 9 SDK: http://msdn.microsoft.com/library/en-us/wmplay/mmp_sdk/windowsmediaplayer9seriessdk.asp ou, pour l'obtenir offline: http://msdn.microsoft.com/library/default.asp?url=/downloads/list/winmedia.asp et http://www.microsoft.com/downloads/details.aspx?FamilyIDä3cbe59-678a-458a-86a7-ff1716fad02f&DisplayLang=en
"The Ultimate Video Game Museum" a écrit dans le message de news:3f759004$0$27594$
Hello,
Est-ce que quelqu'un sait se servir du contrôle WindowsMediaPlayer (wmp.dll) ? Attention je ne parle pas de MediaPlayer (msdxm.ocx).
J'essaye en fait de créer et utiliser la Playlist de ce contrôle pour avoir à éviter de gérer ça moi-même. Ce contrôle est très mal documenté au niveau de Visual Basic. J'ai tenté d'adapter les codes prévus pour C++ ce qui donne le code suivant
---------------------------------------------------------------------- Function PlayList_Initialisation()
' Crée une nouvelle PlayList. WindowsMediaPlayer_Audio.playlistCollection.newPlaylist ("0")
//////////// ici la Playlist est bien créée. Je la retrouve même en démarrant Windows Media Player. //////////// la Playlist porte ici le nom "0" mais ça n'a pas d'importance dans l'état actuel des choses.
End Function ----------------------------------------------------------------------
---------------------------------------------------------------------- Function PlayList_Ajout(Index As Integer, Media As Variant)