home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 6 / mastvb6.iso / ch_code / ch16 / alarm / testform.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-05-17  |  9.2 KB  |  282 lines

  1. VERSION 5.00
  2. Object = "*\AAlarm.vbp"
  3. Begin VB.Form TestForm 
  4.    BackColor       =   &H00C0C0C0&
  5.    Caption         =   "Alarm Control Demo"
  6.    ClientHeight    =   3375
  7.    ClientLeft      =   60
  8.    ClientTop       =   345
  9.    ClientWidth     =   8535
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   3375
  12.    ScaleWidth      =   8535
  13.    StartUpPosition =   3  'Windows Default
  14.    Begin VB.CommandButton Command1 
  15.       Caption         =   "E X I T"
  16.       BeginProperty Font 
  17.          Name            =   "Verdana"
  18.          Size            =   11.25
  19.          Charset         =   0
  20.          Weight          =   400
  21.          Underline       =   0   'False
  22.          Italic          =   0   'False
  23.          Strikethrough   =   0   'False
  24.       EndProperty
  25.       Height          =   495
  26.       Left            =   6720
  27.       TabIndex        =   12
  28.       Top             =   2760
  29.       Width           =   1695
  30.    End
  31.    Begin VB.Frame Frame2 
  32.       Height          =   2535
  33.       Left            =   4440
  34.       TabIndex        =   6
  35.       Top             =   0
  36.       Width           =   3975
  37.       Begin VB.CheckBox Check2 
  38.          BackColor       =   &H00C0C0C0&
  39.          Caption         =   "CountDown"
  40.          BeginProperty Font 
  41.             Name            =   "Verdana"
  42.             Size            =   9.75
  43.             Charset         =   0
  44.             Weight          =   400
  45.             Underline       =   0   'False
  46.             Italic          =   0   'False
  47.             Strikethrough   =   0   'False
  48.          EndProperty
  49.          ForeColor       =   &H00000080&
  50.          Height          =   255
  51.          Left            =   2160
  52.          TabIndex        =   10
  53.          Top             =   960
  54.          Value           =   1  'Checked
  55.          Width           =   1575
  56.       End
  57.       Begin VB.CommandButton StartButton2 
  58.          Caption         =   "Start Timer"
  59.          BeginProperty Font 
  60.             Name            =   "MS Sans Serif"
  61.             Size            =   9.75
  62.             Charset         =   0
  63.             Weight          =   400
  64.             Underline       =   0   'False
  65.             Italic          =   0   'False
  66.             Strikethrough   =   0   'False
  67.          EndProperty
  68.          Height          =   435
  69.          Left            =   240
  70.          TabIndex        =   8
  71.          ToolTipText     =   "aa"
  72.          Top             =   1350
  73.          Width           =   1800
  74.       End
  75.       Begin VB.CommandButton AlarmButton2 
  76.          Caption         =   "Alarm Time"
  77.          BeginProperty Font 
  78.             Name            =   "MS Sans Serif"
  79.             Size            =   9.75
  80.             Charset         =   0
  81.             Weight          =   400
  82.             Underline       =   0   'False
  83.             Italic          =   0   'False
  84.             Strikethrough   =   0   'False
  85.          EndProperty
  86.          Height          =   450
  87.          Left            =   240
  88.          TabIndex        =   7
  89.          Top             =   1890
  90.          Width           =   1800
  91.       End
  92.       Begin AlarmProject.AlarmCtl AlarmCtl2 
  93.          Height          =   495
  94.          Left            =   240
  95.          TabIndex        =   9
  96.          Tag             =   "Process B"
  97.          Top             =   720
  98.          Width           =   1800
  99.          _ExtentX        =   3175
  100.          _ExtentY        =   873
  101.          CountDown       =   -1  'True
  102.          AlarmTime       =   0.790277777777778
  103.       End
  104.       Begin VB.Label Label2 
  105.          Alignment       =   2  'Center
  106.          BackColor       =   &H00C0C0C0&
  107.          Caption         =   "Process B"
  108.          BeginProperty Font 
  109.             Name            =   "Comic Sans MS"
  110.             Size            =   14.25
  111.             Charset         =   0
  112.             Weight          =   700
  113.             Underline       =   0   'False
  114.             Italic          =   0   'False
  115.             Strikethrough   =   0   'False
  116.          EndProperty
  117.          ForeColor       =   &H00FF0000&
  118.          Height          =   375
  119.          Left            =   240
  120.          TabIndex        =   11
  121.          Top             =   240
  122.          Width           =   1800
  123.       End
  124.    End
  125.    Begin VB.Frame Frame1 
  126.       BackColor       =   &H00C0C0C0&
  127.       Height          =   2535
  128.       Left            =   120
  129.       TabIndex        =   0
  130.       Top             =   0
  131.       Width           =   3975
  132.       Begin VB.CheckBox Check1 
  133.          BackColor       =   &H00C0C0C0&
  134.          Caption         =   "CountDown"
  135.          BeginProperty Font 
  136.             Name            =   "Verdana"
  137.             Size            =   9.75
  138.             Charset         =   0
  139.             Weight          =   400
  140.             Underline       =   0   'False
  141.             Italic          =   0   'False
  142.             Strikethrough   =   0   'False
  143.          EndProperty
  144.          ForeColor       =   &H00000080&
  145.          Height          =   255
  146.          Left            =   2220
  147.          TabIndex        =   4
  148.          Top             =   960
  149.          Width           =   1695
  150.       End
  151.       Begin VB.CommandButton StartButton1 
  152.          Caption         =   "Start Timer"
  153.          BeginProperty Font 
  154.             Name            =   "MS Sans Serif"
  155.             Size            =   9.75
  156.             Charset         =   0
  157.             Weight          =   400
  158.             Underline       =   0   'False
  159.             Italic          =   0   'False
  160.             Strikethrough   =   0   'False
  161.          EndProperty
  162.          Height          =   435
  163.          Left            =   240
  164.          TabIndex        =   3
  165.          ToolTipText     =   "aa"
  166.          Top             =   1350
  167.          Width           =   1800
  168.       End
  169.       Begin VB.CommandButton AlarmButton1 
  170.          Caption         =   "Alarm Time"
  171.          BeginProperty Font 
  172.             Name            =   "MS Sans Serif"
  173.             Size            =   9.75
  174.             Charset         =   0
  175.             Weight          =   400
  176.             Underline       =   0   'False
  177.             Italic          =   0   'False
  178.             Strikethrough   =   0   'False
  179.          EndProperty
  180.          Height          =   450
  181.          Left            =   240
  182.          TabIndex        =   2
  183.          Top             =   1890
  184.          Width           =   1800
  185.       End
  186.       Begin AlarmProject.AlarmCtl AlarmCtl1 
  187.          Height          =   495
  188.          Left            =   240
  189.          TabIndex        =   1
  190.          Tag             =   "Process A"
  191.          Top             =   720
  192.          Width           =   1800
  193.          _ExtentX        =   3175
  194.          _ExtentY        =   873
  195.          AlarmTime       =   0.790277777777778
  196.       End
  197.       Begin VB.Label Label1 
  198.          Alignment       =   2  'Center
  199.          BackColor       =   &H00C0C0C0&
  200.          Caption         =   "Process A"
  201.          BeginProperty Font 
  202.             Name            =   "Comic Sans MS"
  203.             Size            =   14.25
  204.             Charset         =   0
  205.             Weight          =   700
  206.             Underline       =   0   'False
  207.             Italic          =   0   'False
  208.             Strikethrough   =   0   'False
  209.          EndProperty
  210.          ForeColor       =   &H00FF0000&
  211.          Height          =   375
  212.          Left            =   240
  213.          TabIndex        =   5
  214.          Top             =   240
  215.          Width           =   1800
  216.       End
  217.    End
  218. Attribute VB_Name = "TestForm"
  219. Attribute VB_GlobalNameSpace = False
  220. Attribute VB_Creatable = False
  221. Attribute VB_PredeclaredId = True
  222. Attribute VB_Exposed = False
  223. '  ******************************
  224. '  ******************************
  225. '  ** MASTERING VB6            **
  226. '  ** by Evangelos Petroutos   **
  227. '  ** SYBEX, 1998              **
  228. '  ******************************
  229. '  ******************************
  230. Private Sub AlarmCtl1_TimeOut()
  231.     MsgBox "The Alarm " & AlarmCtl1.Tag & " has Timed out", , "ALARM CONTROL"
  232. End Sub
  233. Private Sub AlarmCtl2_TimeOut()
  234.     MsgBox "The Alarm " & AlarmCtl2.Tag & " has Timed out", , "ALARM CONTROL"
  235. End Sub
  236. Private Sub Check1_Click()
  237.     If Check1.Value Then
  238.         AlarmCtl1.CountDown = True
  239.     Else
  240.         AlarmCtl1.CountDown = False
  241.     End If
  242. End Sub
  243. Private Sub Check2_Click()
  244.     If Check2.Value Then
  245.         AlarmCtl2.CountDown = True
  246.     Else
  247.         AlarmCtl2.CountDown = False
  248.     End If
  249. End Sub
  250. Private Sub Command1_Click()
  251.     End
  252. End Sub
  253. Private Sub Form_Load()
  254.     Randomize Time
  255.     AlarmCtl1.AlarmTime = Rnd()
  256.     AlarmCtl2.AlarmTime = Rnd()
  257. End Sub
  258. Private Sub StartButton1_Click()
  259.     If StartButton1.Caption = "Start Timer" Then
  260.         AlarmCtl1.StartTimer
  261.         StartButton1.Caption = "Stop Timer"
  262.     Else
  263.         StartButton1.Caption = "Start Timer"
  264.         AlarmCtl1.StopTimer
  265.     End If
  266. End Sub
  267. Private Sub AlarmButton1_Click()
  268.         MsgBox "The alarm will go off at " & AlarmCtl1.AlarmTime
  269. End Sub
  270. Private Sub StartButton2_Click()
  271.     If StartButton2.Caption = "Start Timer" Then
  272.         AlarmCtl2.StartTimer
  273.         StartButton2.Caption = "Stop Timer"
  274.     Else
  275.         StartButton2.Caption = "Start Timer"
  276.         AlarmCtl2.StopTimer
  277.     End If
  278. End Sub
  279. Private Sub AlarmButton2_Click()
  280.     MsgBox "The alarm will go off at " & AlarmCtl2.AlarmTime
  281. End Sub
  282.