2个回答
展开全部
处理click时间播放声音就可以了。
追问
什么意思 ?还需要另外添加什么控件或API函数?
追答
模块代码:
Public 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
窗体代码:
Dim FileName As String
Private Function Play_MP3()
FileName = "F:\KuGou\1.mp3 "
mciSendString "Close MM ", 0, 0, 0
mciSendString "Open " & FileName & " Alias MM ", 0, 0, 0
mciSendString "Play MM ", 0, 0, 0
End Function
Private Sub Command1_Click()
FileName = Text1.Text
Play_MP3
End Sub
其中FileName = Text1.Text可以修改为你自己的,FileName = "F:\KuGou\1.mp3 "这里是播放的歌曲。
展开全部
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Beep
End Sub
Beep
End Sub
追问
?
追答
这样不是在按下按钮是发出声音了吗?
如果想播放特定的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
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
mciSendString "close all", 0, 0, 0
mciSendString "open " & "C:\1.mp3", 0, 0, 0
mciSendString "play " & "C:\1.mp3", 0, 0, 0
End Sub
Private Sub Command2_Click()
'音乐停止播放
mciSendString "close all", 0, 0, 0
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询