home *** CD-ROM | disk | FTP | other *** search
/ Master 95 #1 / MASTER95_1.iso / microsof / vbasic4 / vb4-6.cab / wave.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-07-26  |  5.4 KB  |  176 lines

  1. VERSION 4.00
  2. Begin VB.Form Wave 
  3.    BorderStyle     =   1  'Fixed Single
  4.    ClientHeight    =   1380
  5.    ClientLeft      =   1350
  6.    ClientTop       =   4230
  7.    ClientWidth     =   5715
  8.    Height          =   2070
  9.    Left            =   1290
  10.    LinkMode        =   1  'Source
  11.    LinkTopic       =   "Form4"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   1380
  15.    ScaleWidth      =   5715
  16.    Top             =   3600
  17.    Width           =   5835
  18.    Begin VB.HScrollBar HScroll1 
  19.       Height          =   255
  20.       Left            =   240
  21.       Max             =   100
  22.       TabIndex        =   0
  23.       Top             =   360
  24.       Width           =   5295
  25.    End
  26.    Begin MCI.MMControl MMControl1 
  27.       Height          =   495
  28.       Left            =   1080
  29.       TabIndex        =   3
  30.       Top             =   720
  31.       Width           =   3540
  32.       _version        =   65536
  33.       _extentx        =   6244
  34.       _extenty        =   873
  35.       _stockprops     =   32
  36.       borderstyle     =   1
  37.    End
  38.    Begin VB.Label Label2 
  39.       BeginProperty Font 
  40.          name            =   "Courier"
  41.          charset         =   1
  42.          weight          =   700
  43.          size            =   12
  44.          underline       =   0   'False
  45.          italic          =   0   'False
  46.          strikethrough   =   0   'False
  47.       EndProperty
  48.       Height          =   255
  49.       Left            =   4800
  50.       TabIndex        =   2
  51.       Top             =   0
  52.       Width           =   735
  53.    End
  54.    Begin VB.Label Label1 
  55.       BeginProperty Font 
  56.          name            =   "Courier"
  57.          charset         =   1
  58.          weight          =   700
  59.          size            =   12
  60.          underline       =   0   'False
  61.          italic          =   0   'False
  62.          strikethrough   =   0   'False
  63.       EndProperty
  64.       Height          =   255
  65.       Left            =   360
  66.       TabIndex        =   1
  67.       Top             =   0
  68.       Width           =   615
  69.    End
  70.    Begin VB.Menu AL_FILE 
  71.       Caption         =   "&File"
  72.       Begin VB.Menu AI_OPEN 
  73.          Caption         =   "&Open..."
  74.       End
  75.       Begin VB.Menu AI_SEPARATOR 
  76.          Caption         =   "-"
  77.       End
  78.       Begin VB.Menu AI_EXIT 
  79.          Caption         =   "&Exit"
  80.       End
  81.    End
  82. Attribute VB_Name = "Wave"
  83. Attribute VB_Creatable = False
  84. Attribute VB_Exposed = False
  85. Const conInterval = 50
  86. Const conIntervalPlus = 55
  87. Dim CurrentValue As Double
  88. Private Sub AI_EXIT_Click()
  89.     Unload Wave
  90. End Sub
  91. Private Sub AI_OPEN_Click()
  92.     Dim msec As Double
  93.     ' Set the number of milliseconds between successive
  94.     ' StatusUpdate events.
  95.     MMControl1.UpdateInterval = 0
  96.     ' Display the File Open dialog box.
  97.     OpenDlg.CMDialog1.FilterIndex = 1
  98.     OpenDlg.CMDialog1.Flags = vbOFNReadOnly Or vbOFNFileMustExist
  99.     OpenDlg.CMDialog1.CancelError = True
  100.     OpenDlg.CMDialog1.FileName = ""
  101.     On Error Resume Next
  102.     OpenDlg.CMDialog1.ShowOpen
  103.     If Err <> 0 Then
  104.         ' No file selected from the Open File dialog box.
  105.         Exit Sub
  106.     End If
  107.     ' If the device is open, close it.
  108.     If Not MMControl1.Mode = vbMCIModeNotOpen Then
  109.         MMControl1.Command = "Close"
  110.     End If
  111.     ' Open the device with the new filename.
  112.     MMControl1.FileName = OpenDlg.CMDialog1.FileName
  113.     On Error GoTo MCI_ERROR
  114.     MMControl1.Command = "Open"
  115.     On Error GoTo 0
  116.     Caption = DialogCaption + MMControl1.FileName
  117.     ' Set the timing labels on the form.
  118.     MMControl1.TimeFormat = vbMCIFormatMilliseconds
  119.     Label1.Caption = "0.0"
  120.     msec = (CDbl(MMControl1.Length) / 1000)
  121.     Label2.Caption = Format$(msec, "0.00")
  122.     ' Set the scrollbar values.
  123.     Hscroll1.value = 0
  124.     CurrentValue = 0#
  125.     Exit Sub
  126. MCI_ERROR:
  127.     DisplayErrorMessageBox
  128.     Resume MCI_EXIT
  129. MCI_EXIT:
  130.     Unload Wave
  131. End Sub
  132. Private Sub Form_Load()
  133.     ' Force the multimedia MCI control to complete before returning
  134.     ' to the application.
  135.     Wave.MMControl1.Wait = True
  136. End Sub
  137. Private Sub Form_Unload(Cancel As Integer)
  138.     MCITest.Show
  139. End Sub
  140. Private Sub MMControl1_PauseClick(Cancel As Integer)
  141.     ' Set the number of milliseconds between successive
  142.     ' StatusUpdate events.
  143.     MMControl1.UpdateInterval = 0
  144. End Sub
  145. Private Sub MMControl1_PlayClick(Cancel As Integer)
  146.     ' Set the number of milliseconds between successive
  147.     ' StatusUpdate events.
  148.     MMControl1.UpdateInterval = conInterval
  149. End Sub
  150. Private Sub MMControl1_PrevClick(Cancel As Integer)
  151.     ' Set the number of milliseconds between successive
  152.     ' StatusUpdate events.
  153.     MMControl1.UpdateInterval = 0
  154.     ' Reset the scrollbar values.
  155.     Hscroll1.value = 0
  156.     CurrentValue = 0#
  157.     MMControl1.Command = "Prev"
  158. End Sub
  159. Private Sub MMControl1_StatusUpdate()
  160.     Dim value As Integer
  161.     ' If the device is not playing, reset to the beginning.
  162.     If Not MMControl1.Mode = vbMCIModePlay Then
  163.         Hscroll1.value = Hscroll1.Max
  164.         MMControl1.UpdateInterval = 0
  165.         Exit Sub
  166.     End If
  167.     ' Determine how much of the file has played.  Set a
  168.     ' value of the scrollbar between 0 and 100.
  169.     CurrentValue = CurrentValue + conIntervalPlus
  170.     value = CInt((CurrentValue / MMControl1.Length) * 100)
  171.     If value > Hscroll1.Max Then
  172.         value = 100
  173.     End If
  174.     Hscroll1.value = value
  175. End Sub
  176.