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 / COMPTOOL / MCI / WAVE.FRM (.txt) < prev   
Encoding:
Visual Basic Form  |  1996-11-29  |  5.3 KB  |  172 lines

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