在VB中 怎么播放背景mp3 wma 文件
最好详细一点("playFile")是什么?解释一下谢了,呵呵~~还有怎么会提示mci设备没打开或无法识别?...
最好详细一点
("play File") 是什么 ?
解释一下谢了,呵呵~~ 还有怎么会提示mci设备没打开或无法识别? 展开
("play File") 是什么 ?
解释一下谢了,呵呵~~ 还有怎么会提示mci设备没打开或无法识别? 展开
1个回答
展开全部
Private Declare Function mciExecute Lib "winmm.dll" (ByVal lpstrCommand As String) As Long
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
用这两个函数就好了。
简略的写一下:
Call mciSendString("open " & FileName & " alias File", ReturnStr, 128, 0) '加载,FileName是音乐路径。
Call mciExecute("play File") '播放
FileName两边要有""的,要这样:
Call mciSendString("open """ & FileName & """ alias File", ReturnStr, 128, 0)
这样就可以了.
先用这个好了,肯定可以的
api函数:
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Sub 音乐()
mciSendString "close OpenFile", 0&, 0, 0 '关闭音乐
mciSendString "open """ & App.Path & "\f.i.r. - 11.我最爱的人.mp3 "" alias OpenFile type MPEGVideo", 0&, 0, 0 '指定音乐文件,为mp3格式
mciSendString "play OpenFile", 0&, 0, 0 '播放音乐
End Sub
call 音乐
& App.Path & "\f.i.r. - 11.我最爱的人.mp3换为你的音乐文件路径,
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
用这两个函数就好了。
简略的写一下:
Call mciSendString("open " & FileName & " alias File", ReturnStr, 128, 0) '加载,FileName是音乐路径。
Call mciExecute("play File") '播放
FileName两边要有""的,要这样:
Call mciSendString("open """ & FileName & """ alias File", ReturnStr, 128, 0)
这样就可以了.
先用这个好了,肯定可以的
api函数:
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Sub 音乐()
mciSendString "close OpenFile", 0&, 0, 0 '关闭音乐
mciSendString "open """ & App.Path & "\f.i.r. - 11.我最爱的人.mp3 "" alias OpenFile type MPEGVideo", 0&, 0, 0 '指定音乐文件,为mp3格式
mciSendString "play OpenFile", 0&, 0, 0 '播放音乐
End Sub
call 音乐
& App.Path & "\f.i.r. - 11.我最爱的人.mp3换为你的音乐文件路径,
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询