Media Player code- should work but doesn't (?)
If I create a button on a form in VB.Net, add a COM reference to Windows Media player (so it references msdxm.ocx) and then put the code in:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim mp As New MediaPlayer.MediaPlayer
mp.FileName = "c:\d.mp3"
mp.play()
End Sub
I get the following message when the mp.play() line is reached:
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in MP3Test.exe
Additional information: Exception from HRESULT: 0x800A0005 (CTL_E_ILLEGALFUNCTIONCALL).
:confused:
Any ideas why? BTW d.mp3 does exist in the right place. i've also tried the mp.open("c:\d.mp3") method as well with the same result
ta,
Rob