您好,登錄后才能下訂單哦!
本篇文章為大家展示了VB語言中如何進(jìn)行mp3音樂鬧鐘開發(fā),內(nèi)容簡明扼要并且容易理解,絕對能使你眼前一亮,通過這篇文章的詳細(xì)介紹希望你能有所收獲。
mp3音樂鬧鐘開發(fā)
如何播放指定音樂?
VB中播放音樂利用的是window media player
能夠播放mp3、m4a等格式的音頻
如何進(jìn)行音樂控制?
需要使用代碼控制
界面:
項(xiàng)目列表(這里還有一個音樂文件1.m4a):
源代碼:
Option Explicit
Dim startMusictime As Date
Private Sub Command1_Click()
WindowsMediaPlayer1.URL = App.Path & "\1.m4a"
End Sub
Private Sub Command2_Click()
If Command2.Caption = "重新設(shè)置" Then
Option1.Enabled = True
Option2.Enabled = True
Option3.Enabled = True
Command2.Caption = "設(shè)置音樂定時"
Picture1.Cls
Exit Sub
End If
If Option1.Value Then
startMusictime = DateAdd("s", 5 * 60, Now)
Picture1.Print startMusictime & "開始播放音樂"
ElseIf Option2.Value Then
startMusictime = DateAdd("s", 10 * 60, Now)
Picture1.Print startMusictime & "開始播放音樂"
ElseIf Option3.Value Then
startMusictime = CDate(Text1.Text)
Picture1.Print startMusictime & "開始播放音樂"
Else
MsgBox "請選擇時間"
Exit Sub
End If
Option1.Enabled = False
Option2.Enabled = False
Option3.Enabled = False
Command2.Caption = "重新設(shè)置"
End Sub
Private Sub Command3_Click()
If Command3.Caption = "暫停" Then
WindowsMediaPlayer1.Controls.pause
Command3.Caption = "繼續(xù)播放"
ElseIf Command3.Caption = "繼續(xù)播放" Then
WindowsMediaPlayer1.Controls.play
Command3.Caption = "暫停"
End If
End Sub
Private Sub Option3_Click()
Text1.Text = Now
End Sub
Private Sub Timer1_Timer()
Label1.Caption = "現(xiàn)在時間:" & Now
If Now = startMusictime Then
WindowsMediaPlayer1.URL = App.Path & "\1.m4a"
End If
End Sub
上述內(nèi)容就是VB語言中如何進(jìn)行mp3音樂鬧鐘開發(fā),你們學(xué)到知識或技能了嗎?如果還想學(xué)到更多技能或者豐富自己的知識儲備,歡迎關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。