WMP - 源对象不提供IPropertyNotifySink

时间:2017-09-12 18:22:07

标签: .net vb.net interop wmp axwindowsmediaplayer

我已根据此指示包含对WMP的引用: https://msdn.microsoft.com/de-de/library/windows/desktop/dd564585(v=vs.85).aspx

表单设计器的代码如下所示:

    <System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
    Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmMP))
    Me.wmp1 = New AxWMPLib.AxWindowsMediaPlayer()
    CType(Me.wmp1, System.ComponentModel.ISupportInitialize).BeginInit()
    Me.SuspendLayout()
    '
    'wmp1
    '
    Me.wmp1.Enabled = True
    Me.wmp1.Location = New System.Drawing.Point(67, 51)
    Me.wmp1.Name = "wmp1"
    Me.wmp1.OcxState = CType(resources.GetObject("wmp1.OcxState"), System.Windows.Forms.AxHost.State)
    Me.wmp1.Size = New System.Drawing.Size(75, 23)
    Me.wmp1.TabIndex = 0
    '
    'frmMP
    '
    Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
    Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
    Me.ClientSize = New System.Drawing.Size(284, 261)
    Me.Controls.Add(Me.wmp1)
    Me.Name = "frmMP"
    Me.Text = "frmMP"
    CType(Me.wmp1, System.ComponentModel.ISupportInitialize).EndInit()
    Me.ResumeLayout(False)

End Sub

我现在收到错误&#34; System.ArgumentException:源对象没有提供IPropertyNotifySink事件接口。&#34;在行

CType(Me.wmp1, System.ComponentModel.ISupportInitialize).EndInit()

我不知道我应该在这做什么。 有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)