我可以帮忙用 AxWindowsMediaPlayer 播放音频文件吗?
我正在使用 Visual Basic.net 2012 Ultimate。
这是我的代码:
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
结束类
尝试访问任何对象属性或方法时出现以下错误:
AxInterop.WMPLib.dll 中出现“System.Windows.Forms.AxHost.InvalidActiveXStateException”类型的未处理异常