佈置Timer 和 MMControl 和 Command 這三個物件...布置完之後依序寫入以下程式碼!!!
Option Explicit
Dim dtime As Date
Private Sub Command1_Click()
Cls
dtime = CDate(InputBox("請輸入時間 AM為早上PM為晚上 ", "時間設定", "00:00:00AM"))
Label1.Caption = "時間設定為:" & dtime
End Sub
Private Sub Form_Load()
MMControl1.Visible = False
End Sub
Private Sub Timer1_Timer()
Form1.Caption = "現在時間" & Time
If Hour(dtime) = Hour(Time) And Minute(dtime) = Minute(Time) And Second(dtime) = Second(Time) Then
MMControl1.Command = "Close"
MMControl1.FileName = "D:\鬧鐘\music.mp3"
MMControl1.Command = "open"
MMControl1.Command = "play"
End If
End Sub
全站熱搜
留言列表