最好详细一点
("play File") 是什么 ?
解释一下谢了,呵呵~~ 还有怎么会提示mci设备没打开或无法识别?
在VB中 怎么播放背景mp3 wma 文件
答案:2 悬赏:0 手机版
解决时间 2021-02-12 19:55
- 提问者网友:欺烟
- 2021-02-12 07:02
最佳答案
- 五星知识达人网友:怙棘
- 2021-02-12 07:09
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换为你的音乐文件路径,
全部回答
- 1楼网友:十鸦
- 2021-02-12 07:47
首先添加 windowsmediaplayer控件,label4.caption = windowsmediaplayer1.controls.currentpositionstringlabel5.caption = windowsmediaplayer1.currentmedia.durationstringlabel4是当前时间,label5是总时间
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯