vB中的Windows Media Player控件

用Windows Media Player 打开相同目录下MP3文件的全代码
2025-05-11 05:40:26
推荐回答(1个)
回答1:

参考代码如下

Private Sub File1_Click()
    WindowsMediaPlayer1.url = App.Path + "\" + File1.List(File1.ListIndex)
    WindowsMediaPlayer1.Controls.play
End Sub

Private Sub Form_Load()
    File1.Path = App.Path
End Sub

Private Sub WindowsMediaPlayer1_OpenStateChange(ByVal NewState As Long)
    WindowsMediaPlayer1.url = App.Path + "\1.mp3"
    WindowsMediaPlayer1.Controls.play
    'WindowsMediaPlayer1.controls.pause '暂停
    'Controls.currentPosition = 10 '设置当前播放未知
End Sub