我想实现一个功能就是点一个按钮打开一个音乐文件,然后WMP播放器由原来的不可用按钮变为可用的(我已经把WMP插件添加了),请问各位该如何实现?下面提供我写的代码: Public Class Form1 Inherits System.Windows.Forms.Form Dim StrName As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click OpenFileDialog1.Filter = "mp3文件|*.mp3|所有文件(*.*)|*.*" OpenFileDialog1.ShowDialog() If OpenFileDialog1.FileName <> "" Then Try FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input) Catch ex As Exception
End Try End If StrName = OpenFileDialog1.FileName End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click AxWindowsMediaPlayer1.filename = StrName AxWindowsMediaPlayer1.play() End Sub