home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form frmMain
- BorderStyle = 1 'Fixed Single
- Caption = "frmMain"
- ClipControls = 0 'False
- Height = 3165
- Left = 915
- LinkTopic = "Form1"
- ScaleHeight = 2760
- ScaleWidth = 4305
- Top = 1125
- Width = 4425
- Begin CommandButton cmdExit
- Caption = "E&xit"
- Height = 375
- Left = 2160
- TabIndex = 7
- Top = 1080
- Width = 2055
- End
- Begin Frame fraX
- Caption = "Timer"
- Height = 1095
- Left = 2160
- TabIndex = 3
- Top = 1560
- Width = 2055
- Begin Timer timFlash
- Enabled = 0 'False
- Interval = 500
- Left = 1440
- Top = 240
- End
- Begin OptionButton OptFlashTarget
- Caption = "Flash &ActiveForm"
- Height = 255
- Index = 2
- Left = 120
- TabIndex = 6
- Top = 720
- Width = 1815
- End
- Begin OptionButton OptFlashTarget
- Caption = "Flash &Me"
- Height = 255
- Index = 1
- Left = 120
- TabIndex = 5
- Top = 480
- Width = 1215
- End
- Begin OptionButton OptFlashTarget
- Caption = "&Disabled"
- Height = 255
- Index = 0
- Left = 120
- TabIndex = 4
- Top = 240
- Value = -1 'True
- Width = 1215
- End
- End
- Begin CommandButton cmdClose
- Cancel = -1 'True
- Caption = "&Close Me"
- Height = 375
- Left = 2160
- TabIndex = 2
- Top = 600
- Width = 2055
- End
- Begin CommandButton cmdNextInstance
- Caption = "&New Instance"
- Default = -1 'True
- Height = 375
- Left = 2160
- TabIndex = 1
- Top = 120
- Width = 2055
- End
- Begin ListBox lstForms
- Height = 2565
- Left = 120
- TabIndex = 0
- Top = 120
- Width = 1935
- End
- Option Explicit
- Sub cmdClose_Click ()
- ' Unload this instance
- Unload Me
- ' If this instance happens to be the original frmMain,
- ' must set the implicity declared frmMain variable to Nothing
- ' to release the resources associated with the variable.
- If Me Is frmMain Then
- Set frmMain = Nothing
- End If
- End Sub
- Sub cmdExit_Click ()
- End
- End Sub
- Sub cmdNextInstance_Click ()
- Dim NextInstance As New frmMain ' Form variable
- NextFormNum = NextFormNum + 1
- ' Because form variable was declared with New,
- ' a new instance of frmMain is created as soon
- ' as one of its properties, methods, or controls
- ' is referenced. This happens in the next line.
- NextInstance.Caption = "Instance # " & NextFormNum
- NextInstance.Left = Left + (Width \ 10)
- NextInstance.Top = Top + (Height \ 10)
- NextInstance.Show
- ' Because the form variable is local to this procedure
- ' (and not static) it disappears when the procedure ends.
- ' Outside this procedure, the only way to regain a reference
- ' to the new instance is through the Forms collection.
- End Sub
- Sub Form_Activate ()
- Dim i As Integer
- ' Refill list (in case an instance was added or removed)
- lstForms.Clear
- For i = 0 To Forms.Count - 1
- lstForms.AddItem Forms(i).Caption
- Next
- End Sub
- Sub Form_Load ()
- DisableFrames
- End Sub
- Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
- If frmEnabledTimer Is Me Then Set frmEnabledTimer = Nothing
- DisableFrames
- End Sub
- Sub lstForms_DblClick ()
- Dim i As Integer
- ' Loop through Forms collection looking for
- ' Form with same caption as the entry that
- ' was double-clicked, then activate that form.
- For i = 0 To Forms.Count
- If Forms(i).Caption = lstForms.Text Then
- Forms(i).SetFocus
- Exit For
- End If
- Next
- End Sub
- Sub OptFlashTarget_Click (Index As Integer)
- If Index = 0 Then
- Set frmEnabledTimer = Nothing
- timFlash.Enabled = False
- Else
- Set frmEnabledTimer = Me
- timFlash.Enabled = True
- End If
- DisableFrames
- End Sub
- Sub timFlash_Timer ()
- If OptFlashTarget(1).Value Then
- Flash Me
- Else
- Flash Screen.ActiveForm
- End If
- End Sub
-