home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual BASIC 5.0 (Ent. Edition) / Vb5ent Extractor.EXE / VB / SAMPLES / PGUIDE / VCR / VCR.BAS < prev    next >
Encoding:
BASIC Source File  |  1996-09-16  |  3.7 KB  |  102 lines

  1. Attribute VB_Name = "VCRModule"
  2. '**********************************************
  3. ' Purpose: General module for the VCR sample
  4. ' application. Contains shared procedures
  5. '**********************************************
  6. Option Explicit
  7.  
  8. ' Instantiate the recorder class
  9. Public Recorder As New clsRecorder
  10.  
  11. '**********************************************
  12. ' Purpose:  Enables or disables buttons on the
  13. '           VCR form based on the current mode.
  14. ' Inputs:   Button: the Command button calling
  15. '           the procedure.
  16. '**********************************************
  17. Sub ButtonManager(Button As Control)
  18.     Dim vntControl As Variant   ' Control value
  19.     
  20.     ' determine which function button was pushed
  21.     ' and update all buttons and Recorder class
  22.     Select Case Button
  23.         Case frmVCR.cmdPlay, frmVCR.cmdForward, frmVCR.cmdRewind
  24.             frmVCR.cmdPause.Enabled = True
  25.             frmVCR.cmdStop.Enabled = True
  26.             frmVCR.cmdRec.Enabled = False
  27.             frmVCR.cmdDown.Enabled = False
  28.             frmVCR.cmdUp.Enabled = False
  29.             Recorder.Enabled = False
  30.         Case frmVCR.cmdRec
  31.             frmVCR.cmdPause.Enabled = True
  32.             frmVCR.cmdStop.Enabled = True
  33.             frmVCR.cmdPlay.Enabled = False
  34.             frmVCR.cmdForward.Enabled = False
  35.             frmVCR.cmdRewind.Enabled = False
  36.             frmVCR.cmdDown.Enabled = False
  37.             frmVCR.cmdUp.Enabled = False
  38.             Recorder.Enabled = False
  39.         Case frmVCR.cmdPause
  40.             frmVCR.cmdPause.Enabled = False
  41.         Case frmVCR.cmdStop
  42.             frmVCR.cmdStop.Enabled = False
  43.             frmVCR.cmdPause.Enabled = False
  44.             frmVCR.cmdRec.Enabled = True
  45.             frmVCR.cmdPlay.Enabled = True
  46.             frmVCR.cmdForward.Enabled = True
  47.             frmVCR.cmdRewind.Enabled = True
  48.             frmVCR.cmdDown.Enabled = True
  49.             frmVCR.cmdUp.Enabled = True
  50.             Recorder.Enabled = True
  51.     End Select
  52.     ' assign the button to it's corresponding
  53.     ' shape control
  54.     vntControl = Button.Name
  55.     vntControl = Right$(vntControl, Len(vntControl) - 3)
  56.     vntControl = "shp" & vntControl
  57.     ' call routine to update indicators
  58.     HighlightButton vntControl
  59. End Sub
  60. '**********************************************
  61. ' Purpose:  Enables or disables shape controls
  62. '           on the VCR form based on the current
  63. '           mode.
  64. ' Inputs:   MyControl: the Shape control passed
  65. '           to the procedure.
  66. '**********************************************
  67. Sub HighlightButton(MyControl As Variant)
  68.     Dim i As Integer    ' Counter variable
  69.     
  70.     ' Step through the Controls collection
  71.     For i = 0 To frmVCR.Controls.Count - 1
  72.         ' Test for a Shape control
  73.         If TypeOf frmVCR.Controls(i) Is Shape Then
  74.             ' If it's the passed control, make it
  75.             ' visible, otherwise make it invisible
  76.             If frmVCR.Controls(i).Name = MyControl Then
  77.                 frmVCR.Controls(i).Visible = True
  78.             Else
  79.                 frmVCR.Controls(i).Visible = False
  80.             End If
  81.         End If
  82.     Next
  83. End Sub
  84. '**********************************************
  85. ' Purpose:  Stores the last channel number so
  86. '           we can restore it after recording.
  87. ' Inputs:   Channel: the channel number passed
  88. '           to the procedure.
  89. ' Returns:  The channel stored in the Static variable.
  90. '**********************************************
  91. Function SaveChannel(Channel As Variant) As Integer
  92.     Static intChannel As Integer 'Stores channel
  93.     
  94.     ' assign the value to the Static variable
  95.     If Channel <> 0 Then
  96.         intChannel = Channel
  97.     End If
  98.     
  99.     ' Return the channel number
  100.     SaveChannel = intChannel
  101. End Function
  102.