VB程序生成后音乐等文件的连接问题

来源:百度知道 编辑:UC知道 时间:2024/06/11 08:23:27
我在我的VB程序中增加了音乐,但是是放在C盘的,然后我想把这东西共享给同学们看看,可是生成后如果把音乐文件换个位子,貌似就读取不了音乐了吧??我该怎么办?各位大大教下。

Private Sub Form_Load()
MMControl1.Notify = False
MMControl1.Wait = True
End sub
Private Sub Check1_Click()
If Check1.Value = 1 Then
MMControl1.Command = "close"
MMControl1.DeviceType = ""
MMControl1.FileName = "C:\123.mp3"
MMControl1.Command = "open"
MMControl1.Command = "play"
End If
If Check1.Value = 0 Then
MMControl1.Command = "close"
MMControl1.DeviceType = ""
MMControl1.FileName = "C:\123.mp3"
MMControl1.Command = "open"
MMControl1.Command = "close"
End If
End sub

绝对路径在移植的时候会有问题,我建议你把这些音乐复制到你的工程下面
然后使用相对路径,譬如
MMControl1.FileName = app.path & "\123.mp3"