Using System Time
Posted on 1999-06-29
I created a clock application identical to the one in the MSDN help system example.
I also created a public variant variable called AlarmTime in the subroutine for the timer as seen below I have it check to see if the AlarmTime is less then Time or if it is not equal to 0. "0" is what the variable is set to if no alarm time is entered into a masked edit box on the form.
Play_Sound is a sub that calls a WIN32.API function for the alarm sound.
The whole thing works perfect as long as the AlarmTime variable is not above 09:59:59 AM, after that it plays as soon as you set the alarm, it would seem that it thinks 10:00:00 AM is < then 9:00:00 AM. I thought the system time was the number of seconds since midnight. How do I fix the sub below?
Private Sub Timer1_Timer()
If lblTime.Caption <> CStr(Time) Then
lblTime.Caption = Time
If AlarmTime < CStr(Time) And AlarmTime <> 0 Then