Search code examples
.netwindows-media-playerwmp

Referencing WMP under .NET


I can add the reference to Windows Media Player, but I don't get to the point where I could say

Dim newPlayList As WMPLib.IWMPPlaylist = wmpControl.playlistCollection.newPlaylist("soundsToPlay")

The WMPLib seems to be missing.

I can drag the WindowsMediaPlayer onto a form, but the WMPLib is missing for me.

Thank you very much!


Solution

  • Ah, I got it. I had to rightclick the Toolbox bar and choose "COM" -> "Windows Media Player". Referencing it did not work.

    Then I had to say

    Dim nPlayLists As WMPLib.IWMPPlaylistArray = Me.wmp1.playlistCollection.getAll 'IWMPPlaylistArray
    

    But this still doesn't work:

    For Each nP As WMPLib.IWMPPlaylist In nPlayLists
    

    The error I'm getting is "nPlayLists is not an enumeration".