Option Explicit
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 mciStatus As String ' 存储音乐播放状态
Private Sub Open_Click()
' 打开音频文件对话框
CommonDialog1.DialogTitle = "打开音频文件"
CommonDialog1.Filter = "音频文件(*.mp3;*.wav)|*.mp3;*.wav"
CommonDialog1.Flags = cdlOFNFileMustExist Or cdlOFNPathMustExist
CommonDialog1.ShowOpen
' 将选择的文件路径显示在文本框中
txtAudioFiles.Text = CommonDialog1.FileName
End Sub
Private Sub Play_Click()
' 播放音频文件
mciSendString "open " & Chr(34) & txtAudioFiles.Text & Chr(34) & " alias music", vbNullString, 0, 0
mciSendString "play music", vbNullString, 0, 0
' 更新音乐播放状态
mciStatus = "playing"
End Sub
Private Sub Stop_Click()
' 停止音频文件播放
mciSendString "stop music", vbNullString, 0, 0
mciSendString "close music", vbNullString, 0, 0
' 更新音乐播放状态
mciStatus = "stopped"
End Sub
Private Sub Pause_Click()
' 暂停音频文件播放
mciSendString "pause music", vbNullString, 0, 0
' 更新音乐播放状态
mciStatus = "paused"
End Sub
Private Sub Resume_Click()
' 继续音频文件播放
mciSendString "resume music", vbNullString, 0, 0
' 更新音乐播放状态
mciStatus = "playing"
End Sub
Private Sub Random_Click()
' 设置随机播放
mciSendString "status music mode random", vbNullString, 0, 0
End Sub
Private Sub Sequential_Click()
' 设置顺序播放
mciSendString "status music mode sequential", vbNullString, 0, 0
End Sub
Private Sub Loop_Click()
' 设置循环播放
mciSendString "status music mode loop", vbNullString, 0, 0
End Sub
Private Sub Previous_Click()
' 播放上一个音频文件
mciSendString "prev music", vbNullString, 0, 0
End Sub
Private Sub Next_Click()
' 播放下一个音频文件
mciSendString "next music", vbNullString, 0, 0
End Sub
EasySoft易软
- 粉丝: 3945
- 资源: 1358
最新资源
- (源码)基于Spring Boot和Vue的需求管理系统.zip
- 基于深度学习YOLOv5的车牌检测与识别项目源码
- (源码)基于Python的CSGO饰品价格分析与比较系统.zip
- ccs3.3安装补丁SR12-CCS-v3.3-SR-3.3.82.13 2
- (源码)基于Spring Boot框架的攀枝花物流系统.zip
- (源码)基于Spring Boot和Vue的权限管理系统.zip
- (源码)基于Python和HMM的酵母起始密码子预测系统.zip
- (源码)基于Spring Boot和MyBatis的图书管理系统.zip
- BitComet-2.11.0-x86_64.AppImage
- (源码)基于CC++编程语言的嵌入式游戏系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈