Current location - Music Encyclopedia - NetEase Cloud Music - Voice time reporting code in vb
Voice time reporting code in vb

Dim vhour As Integer, vminute As Integer, vsecond As Integer

Private Sub Form_Load()

Timer1.Enabled = True

Timer1.Interval = 1000

End Sub

Private Sub Timer1_Timer()

vhour = Hour(Time)

vminute = Minute( Time)

vsecond = Second(Time)

If vminute = 0 And vsecond = 0 Then

WindowsMediaPlayer1.URL = App.Path & "/Now time .mp3"

WindowsMediaPlayer1.Controls.play

WindowsMediaPlayer1.URL = App.Path & "/" & vhour & ".mp3"

WindowsMediaPlayer1.Controls .play

End If

End Sub

I have never used the mic control, and replaced it with the Windows Media Player control, which is available in every computer (XP system, component Pull to the bottom)

Place a WindowsMediaPlayer1 and a timer1 in the form

Two of the sounds need to be prepared by yourself. You should be able to understand the code and prepare For sounds and sounds from 0 o'clock to 11 o'clock at night, app.path only wants to be in the program's own folder. You can save the project and then put the music in the folder.

Here I am Hours are used instead of music names, so the music name at 0 o'clock should be "0.mp3" and at 1 o'clock it should be "1.mp3". . . At 11 o'clock in the evening, it is "23.mp3" and so on. I still don't know how to add me on QQ, and the program has not been tested. . . Don't have the patience to wait. . .