playlist WMPLib.IWMPMedia?

Hoongz

Active member
Joined
Nov 22, 2007
Messages
32
Programming Experience
1-3
Thank you very much for the help. I have another question. Can I make a playlist that can add file or remove them through commands or there's only importing a playlist for wmp?
This is my code. The file path name is giving me an error "Unable to cast object of type 'System.String' to type 'WMPLib.IWMPMedia."
Any help or advise please. Thank you..

VB.NET:
Expand Collapse Copy
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim playList = Me.AxMediaPlayer1.newPlaylist("playList1", "")
        AxmediaPlayer1.currentPlaylist = playList
        AxMediaPlayer1.currentPlaylist.appendItem("C:\Documents and Settings\Administrator\Desktop\test.wmv")
        AxMediaPlayer1.Ctlcontrols.play()

        AxMediaPlayer1.settings.setMode("Loop", True)
End Sub
 
Last edited by a moderator:
try this:
VB.NET:
Expand Collapse Copy
Dim m As WMPLib.IWMPMedia = AxWindowsMediaPlayer1.newMedia("your media file path")
AxWindowsMediaPlayer1.currentPlaylist.appendItem(m)
In case you were only trying to start one file, just set the URL property:
VB.NET:
Expand Collapse Copy
AxWindowsMediaPlayer1.URL = "your media file path"
 
Can i ask what's the difference between newplaylist and new media?
And how do I add additional files to the new media? Thank you very much
 
Last edited:
playlist is a list of media.
 
Dim m As WMPLib.IWMPMedia = AxWindowsMediaPlayer1.newMedia("your media file path")
AxWindowsMediaPlayer1.currentPlaylist.appendItem(m)
This code works for me. So everytime I want to add a new file in I just have to assign the pathname to m and appendItem again?
 
Back
Top