home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / A_24hr_Ala2065455132007.psc / Form1.frm < prev    next >
Text File  |  2007-05-12  |  23KB  |  791 lines

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "comctl32.ocx"
  3. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
  4. Begin VB.Form Panel 
  5.    BackColor       =   &H00E0E0E0&
  6.    BorderStyle     =   1  'Fixed Single
  7.    ClientHeight    =   6390
  8.    ClientLeft      =   45
  9.    ClientTop       =   330
  10.    ClientWidth     =   7095
  11.    BeginProperty Font 
  12.       Name            =   "Tahoma"
  13.       Size            =   12
  14.       Charset         =   0
  15.       Weight          =   400
  16.       Underline       =   0   'False
  17.       Italic          =   0   'False
  18.       Strikethrough   =   0   'False
  19.    EndProperty
  20.    Icon            =   "Form1.frx":0000
  21.    LinkTopic       =   "Form1"
  22.    MaxButton       =   0   'False
  23.    MinButton       =   0   'False
  24.    Picture         =   "Form1.frx":058A
  25.    ScaleHeight     =   6390
  26.    ScaleWidth      =   7095
  27.    StartUpPosition =   3  'Windows Default
  28.    Begin MSComDlg.CommonDialog ComD1 
  29.       Left            =   120
  30.       Top             =   2400
  31.       _ExtentX        =   847
  32.       _ExtentY        =   847
  33.       _Version        =   393216
  34.       CancelError     =   -1  'True
  35.    End
  36.    Begin VB.CommandButton OpenS 
  37.       BackColor       =   &H00E0E0E0&
  38.       Caption         =   "Set Alarm Sound"
  39.       BeginProperty Font 
  40.          Name            =   "Tahoma"
  41.          Size            =   8.25
  42.          Charset         =   0
  43.          Weight          =   700
  44.          Underline       =   0   'False
  45.          Italic          =   0   'False
  46.          Strikethrough   =   0   'False
  47.       EndProperty
  48.       Height          =   495
  49.       Left            =   5640
  50.       Style           =   1  'Graphical
  51.       TabIndex        =   18
  52.       Top             =   2400
  53.       Width           =   1095
  54.    End
  55.    Begin VB.CheckBox Check1 
  56.       BackColor       =   &H00E0E0E0&
  57.       Caption         =   "Bounce Around"
  58.       BeginProperty Font 
  59.          Name            =   "Tahoma"
  60.          Size            =   8.25
  61.          Charset         =   0
  62.          Weight          =   700
  63.          Underline       =   0   'False
  64.          Italic          =   0   'False
  65.          Strikethrough   =   0   'False
  66.       EndProperty
  67.       Height          =   285
  68.       Left            =   2760
  69.       TabIndex        =   15
  70.       Top             =   3240
  71.       Value           =   1  'Checked
  72.       Width           =   1695
  73.    End
  74.    Begin VB.CommandButton Command4 
  75.       BackColor       =   &H00E0E0E0&
  76.       Caption         =   "TEST"
  77.       BeginProperty Font 
  78.          Name            =   "Tahoma"
  79.          Size            =   9.75
  80.          Charset         =   0
  81.          Weight          =   700
  82.          Underline       =   0   'False
  83.          Italic          =   0   'False
  84.          Strikethrough   =   0   'False
  85.       EndProperty
  86.       Height          =   495
  87.       Left            =   5640
  88.       Style           =   1  'Graphical
  89.       TabIndex        =   11
  90.       Top             =   3000
  91.       Width           =   1095
  92.    End
  93.    Begin VB.Timer Timer3 
  94.       Enabled         =   0   'False
  95.       Interval        =   80
  96.       Left            =   1440
  97.       Top             =   2280
  98.    End
  99.    Begin ComctlLib.Slider Slider2 
  100.       Height          =   630
  101.       Left            =   120
  102.       TabIndex        =   9
  103.       Top             =   4560
  104.       Width           =   6855
  105.       _ExtentX        =   12091
  106.       _ExtentY        =   1111
  107.       _Version        =   327682
  108.       Max             =   59
  109.    End
  110.    Begin ComctlLib.Slider Slider1 
  111.       Height          =   615
  112.       Left            =   120
  113.       TabIndex        =   5
  114.       Top             =   3600
  115.       Width           =   6855
  116.       _ExtentX        =   12091
  117.       _ExtentY        =   1085
  118.       _Version        =   327682
  119.       Max             =   23
  120.    End
  121.    Begin VB.CommandButton ARMALARM 
  122.       BackColor       =   &H00C0FFC0&
  123.       Caption         =   "ARMED"
  124.       BeginProperty Font 
  125.          Name            =   "Tahoma"
  126.          Size            =   14.25
  127.          Charset         =   0
  128.          Weight          =   400
  129.          Underline       =   0   'False
  130.          Italic          =   0   'False
  131.          Strikethrough   =   0   'False
  132.       EndProperty
  133.       Height          =   975
  134.       Left            =   5640
  135.       Style           =   1  'Graphical
  136.       TabIndex        =   4
  137.       Top             =   120
  138.       Width           =   1335
  139.    End
  140.    Begin VB.CommandButton SetTime 
  141.       BackColor       =   &H00C0FFC0&
  142.       Caption         =   "Set Alarm Time"
  143.       BeginProperty Font 
  144.          Name            =   "Tahoma"
  145.          Size            =   9.75
  146.          Charset         =   0
  147.          Weight          =   700
  148.          Underline       =   0   'False
  149.          Italic          =   0   'False
  150.          Strikethrough   =   0   'False
  151.       EndProperty
  152.       Height          =   975
  153.       Left            =   120
  154.       Style           =   1  'Graphical
  155.       TabIndex        =   3
  156.       Top             =   120
  157.       Width           =   1335
  158.    End
  159.    Begin VB.CommandButton StpAlarm 
  160.       BackColor       =   &H000000FF&
  161.       Caption         =   "TERMINATE"
  162.       BeginProperty Font 
  163.          Name            =   "Tahoma"
  164.          Size            =   27.75
  165.          Charset         =   0
  166.          Weight          =   400
  167.          Underline       =   0   'False
  168.          Italic          =   0   'False
  169.          Strikethrough   =   0   'False
  170.       EndProperty
  171.       Height          =   1095
  172.       Left            =   240
  173.       Style           =   1  'Graphical
  174.       TabIndex        =   2
  175.       Top             =   5160
  176.       Width           =   3735
  177.    End
  178.    Begin VB.Timer Timer2 
  179.       Interval        =   100
  180.       Left            =   1080
  181.       Top             =   2280
  182.    End
  183.    Begin VB.Timer Timer1 
  184.       Interval        =   500
  185.       Left            =   720
  186.       Top             =   2280
  187.    End
  188.    Begin VB.Timer CoolTim 
  189.       Enabled         =   0   'False
  190.       Interval        =   100
  191.       Left            =   1080
  192.       Top             =   2640
  193.    End
  194.    Begin VB.Timer Timer4 
  195.       Enabled         =   0   'False
  196.       Interval        =   4000
  197.       Left            =   720
  198.       Top             =   2640
  199.    End
  200.    Begin VB.Label Label10 
  201.       Alignment       =   2  'Center
  202.       BackColor       =   &H00E0E0E0&
  203.       Caption         =   "Label10"
  204.       BeginProperty Font 
  205.          Name            =   "Tahoma"
  206.          Size            =   14.25
  207.          Charset         =   0
  208.          Weight          =   700
  209.          Underline       =   0   'False
  210.          Italic          =   0   'False
  211.          Strikethrough   =   0   'False
  212.       EndProperty
  213.       Height          =   495
  214.       Left            =   1680
  215.       TabIndex        =   17
  216.       Top             =   1320
  217.       Width           =   3735
  218.    End
  219.    Begin VB.Label Label9 
  220.       Alignment       =   2  'Center
  221.       BackStyle       =   0  'Transparent
  222.       Caption         =   "24 Hour Clock"
  223.       BeginProperty Font 
  224.          Name            =   "Tahoma"
  225.          Size            =   8.25
  226.          Charset         =   0
  227.          Weight          =   700
  228.          Underline       =   0   'False
  229.          Italic          =   0   'False
  230.          Strikethrough   =   0   'False
  231.       EndProperty
  232.       Height          =   375
  233.       Left            =   0
  234.       TabIndex        =   16
  235.       Top             =   2910
  236.       Width           =   7095
  237.    End
  238.    Begin VB.Label Label3 
  239.       Alignment       =   2  'Center
  240.       BackStyle       =   0  'Transparent
  241.       Caption         =   "Adjust Alarm Time"
  242.       BeginProperty Font 
  243.          Name            =   "Tahoma"
  244.          Size            =   12
  245.          Charset         =   0
  246.          Weight          =   700
  247.          Underline       =   0   'False
  248.          Italic          =   0   'False
  249.          Strikethrough   =   0   'False
  250.       EndProperty
  251.       Height          =   375
  252.       Left            =   0
  253.       TabIndex        =   6
  254.       Top             =   2640
  255.       Width           =   7095
  256.    End
  257.    Begin VB.Label Label4 
  258.       BackColor       =   &H00E0E0E0&
  259.       Caption         =   "MINUTE"
  260.       BeginProperty Font 
  261.          Name            =   "Tahoma"
  262.          Size            =   9.75
  263.          Charset         =   0
  264.          Weight          =   700
  265.          Underline       =   0   'False
  266.          Italic          =   0   'False
  267.          Strikethrough   =   0   'False
  268.       EndProperty
  269.       Height          =   255
  270.       Index           =   1
  271.       Left            =   600
  272.       TabIndex        =   10
  273.       Top             =   4320
  274.       Width           =   2415
  275.    End
  276.    Begin VB.Label Label5 
  277.       Alignment       =   2  'Center
  278.       Appearance      =   0  'Flat
  279.       BackColor       =   &H00000000&
  280.       BorderStyle     =   1  'Fixed Single
  281.       Caption         =   "00:00"
  282.       BeginProperty Font 
  283.          Name            =   "Tahoma"
  284.          Size            =   14.25
  285.          Charset         =   0
  286.          Weight          =   700
  287.          Underline       =   0   'False
  288.          Italic          =   0   'False
  289.          Strikethrough   =   0   'False
  290.       EndProperty
  291.       ForeColor       =   &H00FFFF00&
  292.       Height          =   375
  293.       Left            =   120
  294.       TabIndex        =   8
  295.       Top             =   1680
  296.       Width           =   1455
  297.    End
  298.    Begin VB.Label Label4 
  299.       BackColor       =   &H00E0E0E0&
  300.       Caption         =   "HOUR"
  301.       BeginProperty Font 
  302.          Name            =   "Tahoma"
  303.          Size            =   9.75
  304.          Charset         =   0
  305.          Weight          =   700
  306.          Underline       =   0   'False
  307.          Italic          =   0   'False
  308.          Strikethrough   =   0   'False
  309.       EndProperty
  310.       Height          =   375
  311.       Index           =   0
  312.       Left            =   600
  313.       TabIndex        =   7
  314.       Top             =   3240
  315.       Width           =   855
  316.    End
  317.    Begin VB.Label Label1 
  318.       Alignment       =   2  'Center
  319.       BackColor       =   &H00000000&
  320.       BorderStyle     =   1  'Fixed Single
  321.       Caption         =   "00:00:00"
  322.       BeginProperty Font 
  323.          Name            =   "Tahoma"
  324.          Size            =   36
  325.          Charset         =   0
  326.          Weight          =   700
  327.          Underline       =   0   'False
  328.          Italic          =   0   'False
  329.          Strikethrough   =   0   'False
  330.       EndProperty
  331.       ForeColor       =   &H0000FF00&
  332.       Height          =   975
  333.       Left            =   1680
  334.       TabIndex        =   0
  335.       Top             =   120
  336.       Width           =   3735
  337.    End
  338.    Begin VB.Label Label2 
  339.       BackColor       =   &H00E0E0E0&
  340.       BeginProperty Font 
  341.          Name            =   "MS Sans Serif"
  342.          Size            =   8.25
  343.          Charset         =   0
  344.          Weight          =   400
  345.          Underline       =   0   'False
  346.          Italic          =   0   'False
  347.          Strikethrough   =   0   'False
  348.       EndProperty
  349.       Height          =   1215
  350.       Left            =   0
  351.       TabIndex        =   1
  352.       Top             =   0
  353.       Width           =   7215
  354.    End
  355.    Begin VB.Label Label6 
  356.       Alignment       =   2  'Center
  357.       BackColor       =   &H00E0E0E0&
  358.       Caption         =   "Alarm Time"
  359.       BeginProperty Font 
  360.          Name            =   "Tahoma"
  361.          Size            =   8.25
  362.          Charset         =   0
  363.          Weight          =   700
  364.          Underline       =   0   'False
  365.          Italic          =   0   'False
  366.          Strikethrough   =   0   'False
  367.       EndProperty
  368.       Height          =   255
  369.       Left            =   120
  370.       TabIndex        =   12
  371.       Top             =   1440
  372.       Width           =   1455
  373.    End
  374.    Begin VB.Label Label8 
  375.       Alignment       =   2  'Center
  376.       Appearance      =   0  'Flat
  377.       BackColor       =   &H00000000&
  378.       BorderStyle     =   1  'Fixed Single
  379.       Caption         =   "00:00:00"
  380.       BeginProperty Font 
  381.          Name            =   "Tahoma"
  382.          Size            =   14.25
  383.          Charset         =   0
  384.          Weight          =   700
  385.          Underline       =   0   'False
  386.          Italic          =   0   'False
  387.          Strikethrough   =   0   'False
  388.       EndProperty
  389.       ForeColor       =   &H0000FFFF&
  390.       Height          =   375
  391.       Left            =   5520
  392.       TabIndex        =   14
  393.       Top             =   1680
  394.       Width           =   1455
  395.    End
  396.    Begin VB.Label Label7 
  397.       Alignment       =   2  'Center
  398.       BackColor       =   &H00E0E0E0&
  399.       Caption         =   "Sleep Time"
  400.       BeginProperty Font 
  401.          Name            =   "Tahoma"
  402.          Size            =   8.25
  403.          Charset         =   0
  404.          Weight          =   700
  405.          Underline       =   0   'False
  406.          Italic          =   0   'False
  407.          Strikethrough   =   0   'False
  408.       EndProperty
  409.       Height          =   255
  410.       Left            =   5520
  411.       TabIndex        =   13
  412.       Top             =   1440
  413.       Width           =   1455
  414.    End
  415. End
  416. Attribute VB_Name = "Panel"
  417. Attribute VB_GlobalNameSpace = False
  418. Attribute VB_Creatable = False
  419. Attribute VB_PredeclaredId = True
  420. Attribute VB_Exposed = False
  421. Option Explicit
  422.  
  423. '                           Alarm Clock - By Ken Slater - 0x34 - 2007
  424. '                                    Free, Open Source Code
  425. '                                             Enjoy
  426. '
  427. '                                      lpd52@sbcglobal.net
  428.  
  429. Dim cTime As String
  430. Dim aHR As String
  431. Dim aMN As String
  432. Dim aHRi As Integer
  433. Dim aMNi As Integer
  434. Dim aTime As String
  435. Dim aSET As Boolean
  436. Dim RedLev As Integer
  437. Dim RedD As Boolean
  438. Dim RedLevL As Integer
  439. Dim Triggered As Boolean
  440. Dim CLIK As Long
  441. Dim COOL As Integer
  442.  
  443. Private Sub StpAlarm_Click() ' Stop Alarm Button
  444.     Timer2.Enabled = False
  445.     StpAlarm.Visible = False
  446.     StpAlarm.FontSize = 18
  447.     Label2.BackColor = &H8000000B
  448.     Label1.ForeColor = vbGreen
  449.     ARMALARM_Click
  450.     Timer4.Enabled = False
  451. End Sub
  452.  
  453. Private Sub SetTime_Click()
  454. If aSET Then
  455.     ARMALARM_Click
  456.     Exit Sub
  457. End If
  458. If Panel.Height = 5700 Then '5700
  459.     Panel.Height = 2745
  460.     ARMALARM.Enabled = True
  461.     Label8.ForeColor = &H8000000B
  462.     CoolTim.Enabled = False
  463.     SetTime.Caption = "Set Alarm Time"
  464.     SetTime.BackColor = &HC0FFC0
  465. Else
  466.     Panel.Height = 5700 '5700
  467.     SetTime.Caption = ""
  468.     SetTime.BackColor = &HC0FFFF
  469.     CoolTim.Enabled = True
  470.     COOL = 0
  471.     ARMALARM.Enabled = False
  472.     Label8.ForeColor = vbYellow
  473. End If
  474. End Sub
  475.  
  476. Private Sub ARMALARM_Click()  '  ARM Button
  477. Dim E As String
  478. If AlarmSound = "NA" Then
  479.     MsgBox "No Alarm Sound Selected!", vbExclamation, "Can't Set"
  480.     Exit Sub
  481. End If
  482. E = Format(Now, "hh:mm")
  483.     If aTime = E And Triggered = False Then
  484.         Beep
  485.         Exit Sub
  486.     End If
  487.     If aSET = True Then
  488.         Timer2.Enabled = False
  489.         StpAlarm.Visible = False
  490.         StpAlarm.FontSize = 18
  491.         Label2.BackColor = &HE0E0E0
  492.         Label1.ForeColor = vbGreen
  493.         Timer4.Enabled = False
  494.         aSET = False
  495.         ARMALARM.BackColor = &HC0FFC0
  496.         ARMALARM.Caption = "ARM"
  497.         SetTime.Enabled = True
  498.         Timer3.Enabled = False
  499.         Timer4.Enabled = False
  500.         Triggered = False
  501.         Label8.ForeColor = &H8000000B
  502.         SetTime.BackColor = &HC0FFC0
  503.         SetTime.FontSize = 10
  504.         SetTime.FontBold = True
  505.         SetTime.Caption = "Set Alarm Time"
  506.     Else
  507.         aSET = True
  508.         Label8.ForeColor = vbYellow
  509.         SetTime.BackColor = vbRed
  510.         ARMALARM.BackColor = vbRed
  511.         ARMALARM.Caption = "ARMED"
  512.         SetTime.Caption = "ARMED"
  513.         SetTime.FontSize = 14
  514.         SetTime.FontBold = False
  515.         RedLevL = 100
  516.         SetTime.BackColor = RGB(RedLevL, 0, 0)
  517.         Triggered = False
  518.         RedLev = 255
  519.         Timer3.Enabled = True
  520.     End If
  521.     If Timer2.Enabled = True Then
  522.         StpAlarm_Click
  523.     End If
  524. End Sub
  525.  
  526. Private Sub Command4_Click()    '   Test Button, to make sure your PC's audio is set correctly.
  527. If AlarmSound = "NA" Then Exit Sub
  528.     CLIK = sndPlaySound(AlarmSound, 1)
  529. End Sub
  530.  
  531. Private Sub OpenS_Click() ' Open a New Alarm Sound (WAV)
  532. On Error GoTo Error
  533.     With ComD1
  534.         .InitDir = "C:\Windows\Media"   '<---- Change to whatever you like, just a starting place.
  535.         .Flags = &H1
  536.         .Flags = &H2
  537.         .DefaultExt = "wav"
  538.         .Filter = "Wav Files (*.wav)|*.wav"
  539.         .DialogTitle = "Open Alarm Sound"
  540.         .Flags = &H4
  541.         .Flags = &H1000
  542.         .ShowOpen
  543.     End With
  544.         MousePointer = vbHourglass
  545.         If ComD1.FileName = "" Then
  546.             MousePointer = vbDefault
  547.             Exit Sub
  548.         End If
  549.         AlarmSound = ComD1.FileName
  550.         SavePrefs (App.Path & "\APref.ini")
  551.         MousePointer = vbDefault
  552.         Debug.Print AlarmSound
  553.     Exit Sub
  554. Error:
  555.     MousePointer = vbDefault
  556.     If Err.Number = 32755 Then Exit Sub
  557.     MsgBox "Error loading Sound File. " & vbNewLine & _
  558.     "ERROR #" & Err.Number & " - " & Error$(Err.Number), vbCritical, "File Load Error"
  559.     Close #1
  560.     Exit Sub
  561. End Sub
  562.  
  563. Private Sub CoolTim_Timer() 'Cool animated Caption
  564.     If COOL < 9 Then
  565.         SetTime.Caption = Left$("Close Me", COOL)
  566.     End If
  567.     COOL = COOL + 1
  568.     If COOL > 13 Then COOL = 0
  569. Exit Sub
  570. End Sub
  571.  
  572. Private Sub Form_Load()
  573.     Panel.Height = 2745
  574.     Label8.ForeColor = &H8000000B
  575.     Label10 = Format(Now, "dddd, mm/dd/yyyy")
  576.     aHR = "00"
  577.     aMN = "00"
  578.     aHRi = 0
  579.     aMNi = 0
  580.     aTime = "00:00"
  581.     Label5 = aTime & ":00"
  582.     cTime = Format(Now, "hh:mm:ss")
  583.     Panel.Caption = Rex
  584.     Label1 = cTime
  585.     StpAlarm.FontSize = 18
  586.     StpAlarm.Visible = False
  587.     ARMALARM.Caption = "ARM"
  588.     Timer2.Enabled = False
  589.     Timer4.Enabled = False
  590.     StpAlarm.Left = 1680
  591.     StpAlarm.Top = 1150
  592.     AlarmSound = "NA"
  593.     OpenPrefs (App.Path & "\APref.ini")
  594. End Sub
  595.  
  596. Private Sub Form_Unload(Cancel As Integer)
  597. On Error Resume Next
  598.     Unload About
  599. End Sub
  600.  
  601. Private Sub Label1_Click()
  602. If aSET And Timer2.Enabled = True Then
  603.     ARMALARM_Click
  604.     Exit Sub
  605. End If
  606. End Sub
  607.  
  608. Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  609.     If Button = 2 Then
  610.         About.Show
  611.     End If
  612. End Sub
  613.  
  614. Private Sub Slider1_Scroll()
  615.     aHR = Slider1
  616.     aHRi = Slider1
  617.     UpDateAT
  618. End Sub
  619.  
  620. Private Sub Slider2_Scroll()
  621.     aMN = Slider2
  622.     aMNi = Slider2
  623.     UpDateAT
  624. End Sub
  625.  
  626. Private Sub Timer1_Timer()  '   Update Main Clock / Compare Alarm Time
  627. Dim E As String
  628.     cTime = Format(Now, "hh:mm:ss")
  629.     Label1 = cTime
  630.     Label10 = Format(Now, "dddd, mm/dd/yyyy")
  631.     If aSET Then
  632.         E = Format(Now, "hh:mm")
  633.         If aTime = E And Triggered = False Then
  634.             Trigger
  635.             Triggered = True
  636.         End If
  637.     End If
  638.     DetTR
  639. End Sub
  640.  
  641. Private Sub Timer2_Timer()  '   Sound Alarm 1
  642.     If Label2.BackColor = vbRed Then
  643.         Label2.BackColor = &HE0E0E0
  644.         StpAlarm.FontSize = 22
  645.         Label1.ForeColor = vbRed
  646.     Else
  647.         Label2.BackColor = vbRed
  648.         Label1.ForeColor = vbGreen
  649.         StpAlarm.FontSize = 28
  650.     End If
  651.     If Check1.Value = 1 Then
  652.         Bounce
  653.     End If
  654. End Sub
  655.  
  656. Public Sub UpDateAT()
  657. Dim TotTIME As String
  658.     If Len(aHR) < 2 Then
  659.         aHR = "0" & aHR
  660.     End If
  661.     If Len(aMN) < 2 Then
  662.         aMN = "0" & aMN
  663.     End If
  664.     TotTIME = aHR & ":" & aMN
  665.     Label5.Caption = TotTIME & ":00"
  666.     aTime = TotTIME
  667.     DetTR
  668. End Sub
  669.  
  670. Private Sub Timer3_Timer()  ' Fade red on buttons when armed
  671.     If RedD Then
  672.         RedLev = RedLev - 10
  673.         RedLevL = RedLevL + 10
  674.         If RedLev < 100 Then
  675.             RedLev = 100
  676.             RedLevL = 255
  677.             RedD = False
  678.         End If
  679.     Else
  680.         RedLev = RedLev + 10
  681.         RedLevL = RedLevL - 10
  682.         If RedLev > 255 Then
  683.             RedLev = 255
  684.             RedLevL = 100
  685.             RedD = True
  686.         End If
  687.     End If
  688.     SetTime.BackColor = RGB(RedLevL, 0, 0)
  689.     ARMALARM.BackColor = RGB(RedLev, 0, 0)
  690. End Sub
  691.  
  692. Private Sub Trigger()
  693.     StpAlarm.Visible = True
  694.     Timer2.Enabled = True
  695.     CLIK = sndPlaySound(AlarmSound, 1)
  696.     Timer4.Enabled = True
  697. End Sub
  698.  
  699. Private Sub Timer4_Timer()  ' Sound Alarm 2
  700.     CLIK = sndPlaySound(AlarmSound, 1)
  701. End Sub
  702.  
  703. Private Sub DetTR() '   Calculate the Remaining amount of Time to Sleep
  704. Dim qMM As Variant
  705. Dim qHH As Variant
  706. Dim qSS As Variant
  707. Dim tTmp As String
  708. Dim ctimeHH As Integer
  709. Dim ctimeMM As Integer
  710. Dim cTimeSS As Integer
  711. Dim sHH As String
  712. Dim sMM As String
  713. Dim sSS As String
  714.     If Timer4.Enabled = True Then   ' If the Alarm is sounding, exit.
  715.         If Label8.ForeColor <> vbRed Then
  716.             Label8.Caption = "00:00:00"
  717.             Label8.ForeColor = vbRed
  718.         End If
  719.         Exit Sub
  720.     End If
  721.     qHH = Left$((Format(Now, "hh,mm")), 2)     ' Get Hour
  722.     qMM = Right$((Format(Now, "hh,mm")), 2)    ' Get Minute
  723.     qSS = Right$((Format(Now, "hh,mm,ss")), 2) ' Get Second
  724.     If aHRi < qHH Then
  725.         ctimeHH = (24 - qHH) + aHRi
  726.     Else
  727.         ctimeHH = aHRi - qHH
  728.     End If
  729.     If qMM > aMNi Then
  730.         ctimeHH = ctimeHH - 1
  731.         If ctimeHH = -1 Then ctimeHH = 23
  732.         ctimeMM = (60 + aMNi) - qMM
  733.     Else
  734.         ctimeMM = aMNi - qMM
  735.     End If
  736.     
  737.     If qSS > 0 Then
  738.         ctimeMM = ctimeMM - 1
  739.         If ctimeMM = -1 Then
  740.             If aHRi <> qHH Then
  741.                 ctimeMM = 59
  742.                 ctimeHH = ctimeHH - 1
  743.             Else
  744.                 ctimeMM = 59
  745.                 ctimeHH = 23
  746.             End If
  747.         End If
  748.         cTimeSS = 60 - qSS
  749.     Else
  750.         cTimeSS = 0
  751.     End If
  752.     
  753.     sHH = ctimeHH
  754.     sMM = ctimeMM
  755.     sSS = cTimeSS
  756.     If Len(sSS) < 2 Then    '   This part just cleans it up by adding a 0 if needed.
  757.         sSS = "0" & sSS
  758.     End If
  759.     If Len(sHH) < 2 Then
  760.         sHH = "0" & sHH
  761.     End If
  762.     If Len(sMM) < 2 Then
  763.         sMM = "0" & sMM
  764.     End If
  765.     tTmp = sHH & ":" & sMM & ":" & sSS
  766.     Label8.Caption = tTmp
  767. End Sub
  768.  
  769. Private Sub Bounce() ' Jump Around, Jump Around, Get up, get up and get down!
  770. Dim qMM As Byte
  771.     qMM = Int((4 * Rnd) + 1)
  772.     Select Case qMM
  773.         Case 1
  774.             If (Me.Left - 100) > 0 Then ' Move Left
  775.                 Me.Left = Me.Left - 100
  776.             End If
  777.         Case 2
  778.             If ((Me.Left + Me.Width) + 100) < Screen.Width Then ' Move Right
  779.                 Me.Left = Me.Left + 100
  780.             End If
  781.         Case 3
  782.             If ((Me.Top + Me.Height) + 100) < Screen.Height Then ' Move Down
  783.                 Me.Top = Me.Top + 100
  784.             End If
  785.         Case 4
  786.             If (Me.Top - 100) > 0 Then ' Move Up
  787.                 Me.Top = Me.Top - 100
  788.             End If
  789.     End Select
  790. End Sub
  791.