Getting the current Media Player song
I've got a Forms application that needs to get the current song in WMP. So far, my code is:
Code:
Imports WMPLib
Public Class Form1
Dim wmp As WindowsMediaPlayer = New WindowsMediaPlayer
Dim playlist As IWMPPlaylist = wmp.mediaCollection.getAll()
Dim media As IWMPMedia = playlist.Item(100)
Private Sub next1_Click() Handles next1.Click
Label1.Text = media.getItemInfo("Title")
End Sub
End Class
As expected, this gets the Title of my 100th song and it does work. However, if I try Dim media As IWMPMedia = wmp.currentMedia and Label1.Text = media.getItemInfo("Title") I get a NullReferenceException
I'm pretty sure this should be possible as it's all there on the MSDN documentation, I just can't get it to work.