Option Explicit Dim alarmTime Const conminimized = 1
'命令按钮"输入报时"的单击事件过程代码 Private Sub Command1_Click() alarmTime = InputBox("输入定时时间(格式00:00:00)?", "定时闹钟", alarmTime) If alarmTime = "" Then Exit Sub If Not IsDate(alarmTime) Then MsgBox ("输入无效,请输入正确的时间格式!!!") Else alarmTime = CDate(alarmTime) End If End Sub
Private Sub Command2_Click() Unload Me End Sub '窗体form1装载事件过程代码 Private Sub Form_Load() Label1.Caption = Time alarmTime = "" End Sub
' 自定义过程"setcaptiontime"代码 Private Sub setcaptiontime() Caption = Format(Time, "medium time") End Sub
Private Sub Form_Resize() If WindowState = conminimized Then setcaptiontime Else Caption = "定时闹钟" End If End Sub '定进器timer1"时间到"事件过程代码 Private Sub Timer1_Timer()~~~~~~~~~~~~~~~~~这以下我就不太懂了,请指教 Static alarmsounded As Integer If Label1.Caption <> CStr(Time) Then If Time >= alarmTime And Not alarmsounded Then Beep MsgBox "闹铃时间:" & Time alarmsounded = False End If If WindowState = conminimized Then If Minute(CDate(Caption)) <> Minute(Time) Then setcaptiontime Else Label1.Caption = Time End If End If End Sub