home *** CD-ROM | disk | FTP | other *** search
/ CD Direkt 1995 #1 / Image.iso / cdd / source / vbsource / alarm12 / asample.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-03-14  |  2.8 KB  |  80 lines

  1. VERSION 2.00
  2. Begin Form ASample 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Alarm Sample"
  5.    ClientHeight    =   3630
  6.    ClientLeft      =   2280
  7.    ClientTop       =   2100
  8.    ClientWidth     =   3495
  9.    Height          =   4035
  10.    Icon            =   ASAMPLE.FRX:0000
  11.    Left            =   2220
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    ScaleHeight     =   3630
  15.    ScaleWidth      =   3495
  16.    Top             =   1755
  17.    Width           =   3615
  18.    Begin MabryAlarm Alarm1 
  19.       Left            =   120
  20.       Top             =   120
  21.    End
  22.    Begin Label Label2 
  23.       Caption         =   "This is a very simple demonstration of the Alarm custom control.  This program uses the control to update the clock every second with the current time.  It also uses the control to notify the program every 10 seconds (the clock color is changed randomly every 10 seconds).  Lastly, the program uses Alarm to beep every 15 minutes (on the hour, half hour, and quarter hours)."
  24.       Height          =   2415
  25.       Left            =   240
  26.       TabIndex        =   1
  27.       Top             =   960
  28.       Width           =   3015
  29.    End
  30.    Begin Label Label1 
  31.       Alignment       =   2  'Center
  32.       FontBold        =   -1  'True
  33.       FontItalic      =   0   'False
  34.       FontName        =   "MS Sans Serif"
  35.       FontSize        =   17.25
  36.       FontStrikethru  =   0   'False
  37.       FontUnderline   =   0   'False
  38.       Height          =   495
  39.       Left            =   240
  40.       TabIndex        =   0
  41.       Top             =   240
  42.       Width           =   3015
  43.    End
  44. Option Explicit
  45. Const AT_Second = 0
  46. Const AT_Hour = 1
  47. Const AT_Minute15 = 2
  48. Const AT_HalfHour = 3
  49. Const AT_Minute45 = 4
  50. Const AT_ColorChange = 10
  51. Sub Alarm1_Alarm (AlarmIndex As Long, TimeNow As String)
  52.     Label1.Caption = TimeNow
  53.     Select Case AlarmIndex
  54.         Case AT_Hour        ' beep three times on the hour
  55.             Beep
  56.             Beep
  57.             Beep
  58.         Case AT_Minute15    ' once on the quarter hour
  59.             Beep
  60.         Case AT_HalfHour    ' twice on the half hour
  61.             Beep
  62.             Beep
  63.         Case AT_Minute45    ' once on the quarter hour
  64.             Beep
  65.         Case AT_ColorChange ' change colors every 10 seconds
  66.                             ' definitely ugly (random color)
  67.             Label1.ForeColor = Rnd * &H1000000
  68.     End Select
  69. End Sub
  70. Sub Form_Load ()
  71.     ASample.Left = (Screen.Width - ASample.Width) / 2
  72.     ASample.Top = (Screen.Height - ASample.Height) / 2
  73.     Alarm1.AlarmTime(AT_Second) = "??:??:??"
  74.     Alarm1.AlarmTime(AT_Hour) = "??:00:00"
  75.     Alarm1.AlarmTime(AT_Minute15) = "??:15:00"
  76.     Alarm1.AlarmTime(AT_HalfHour) = "??:30:00"
  77.     Alarm1.AlarmTime(AT_Minute45) = "??:45:00"
  78.     Alarm1.AlarmTime(AT_ColorChange) = "??:??:?0"
  79. End Sub
  80.