Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to develop mp3 Music alarm clock in VB language

Shulou Source: shulou.com Published: 2022-06-01 02:59:46 10月03日 Update

This article shows you how to develop mp3 music alarm clock in VB language. The content is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Development of mp3 Music alarm clock

How do I play specified music?

Window media player is used to play music in VB

Can play audio in mp3, M4a and other formats

How to control music?

Need to use code control

Interface:

List of projects (there is also a music file 1.m4a):

Source code:

Option ExplicitDim startMusictime As DatePrivate Sub Command1_Click () WindowsMediaPlayer1.URL = App.Path & "\ 1.m4a" End Sub

Private Sub Command2_Click ()

If Command2.Caption = "reset" Then Option1.Enabled = True Option2.Enabled = True Option3.Enabled = True Command2.Caption = "set Music timing" Picture1.Cls Exit SubEnd If

If Option1.Value Then startMusictime = DateAdd ("s", 5 * 60, Now) Picture1.Print startMusictime & "start playing music" ElseIf Option2.Value Then startMusictime = DateAdd ("s", 10 * 60, Now) Picture1.Print startMusictime & "start playing music" ElseIf Option3.Value Then startMusictime = CDate (Text1.Text) Picture1.Print startMusictime & "start playing music" Else MsgBox "Please select a time" Exit SubEnd If

Option1.Enabled = FalseOption2.Enabled = FalseOption3.Enabled = FalseCommand2.Caption = "reset" End Sub

Private Sub Command3_Click () If Command3.Caption = "pause" Then WindowsMediaPlayer1.Controls.pause Command3.Caption = "resume playback" ElseIf Command3.Caption = "resume playback" Then WindowsMediaPlayer1.Controls.play Command3.Caption = "pause" End IfEnd Sub

Private Sub Option3_Click () Text1.Text = NowEnd Sub

Private Sub Timer1_Timer () Label1.Caption = "now time:" & NowIf Now = startMusictime Then WindowsMediaPlayer1.URL = App.Path & "\ 1.m4a" End IfEnd Sub

The above content is how to develop mp3 music alarm clock in VB language. have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Tags: Music alarm clock development language content skills knowledge control concise concise code that is files articles time more format source code present tense interface Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Xiaomi Shulou Tech Info Shulou Technology Shulou Information