VB.net里面怎么添加音乐
来源:百度知道 编辑:UC知道 时间:2024/06/06 11:46:54
添加一个 WindowsMediaPlayer 控件
一句代码即可播放音乐
AxWindowsMediaPlayer1.URL = "音乐地址"
给你个 很简单的
Public Class Form1
Private Declare Function mciExecute Lib "winmm.dll" (ByVal lpstrCommand As String) As Long
‘ 声明函数 mciexcute 加入库 winmm.all
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call mciExecute("play E:\music\music\单身情歌.wma ")
'在 formload过程中 调用函数 mciexcute 里面 是 文件 路径
End Sub
End Class
仅供参考:
Sub playsound()
Dim SoundInst As New SoundClass
SoundInst.PlaySoundFile("F:msgs.wav")
End Sub
Public Class SoundClass
Declare Auto Function PlaySound Lib "winmm.dll" (ByVal name _
As String, ByVal hmod As Integer, ByVal flags As Integer) As Integer
Public Const SND_SYNC = &H0
Public Const SND_