Can I please have some help to play a audio file with the AxWindowsMediaPlayer.
I am using Visual Basic.net 2012 Ultimate.
Here is my code:
Imports AxWMPLib
Public Class Form1
Public WithEvents MediaPlayerObject As AxWindowsMediaPlayer = New AxWindowsMediaPlayer
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
MediaPlayerObject = New AxWindowsMediaPlayer
MediaPlayerObject.Ctlenabled = True
MediaPlayerObject.URL = "C:\Users\Simon\Music\Music\CanLucidDream\108761__soundbytez__birds-late-morning.wav"
MediaPlayerObject.Ctlcontrols.play()
End Sub
End Class
I get the following error when trying to access any of the objects properties or methods:
An unhandled exception of type 'System.Windows.Forms.AxHost.InvalidActiveXStateException' occurred in AxInterop.WMPLib.dll