home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Programmer'…arterly (Limited Edition) / Visual_Basic_Programmers_Journal_VB-CD_Quarterly_Limited_Edition_1995.iso / code / ch28code / waves.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-07-31  |  4.4 KB  |  146 lines

  1. VERSION 4.00
  2. Begin VB.Form frmWaves 
  3.    Caption         =   "Wave Tester"
  4.    ClientHeight    =   1920
  5.    ClientLeft      =   1290
  6.    ClientTop       =   1515
  7.    ClientWidth     =   4575
  8.    Height          =   2325
  9.    Icon            =   "WAVES.frx":0000
  10.    Left            =   1230
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    ScaleHeight     =   1920
  14.    ScaleWidth      =   4575
  15.    Top             =   1170
  16.    Width           =   4695
  17.    Begin VB.Frame fraType 
  18.       Caption         =   "Wave &Type"
  19.       Height          =   1215
  20.       Left            =   2400
  21.       TabIndex        =   3
  22.       Top             =   120
  23.       Width           =   2055
  24.       Begin VB.OptionButton optType 
  25.          Caption         =   "&Resources"
  26.          Height          =   255
  27.          Index           =   1
  28.          Left            =   120
  29.          TabIndex        =   5
  30.          Top             =   795
  31.          Value           =   -1  'True
  32.          Width           =   1815
  33.       End
  34.       Begin VB.OptionButton optType 
  35.          Caption         =   "&Files..."
  36.          Height          =   255
  37.          Index           =   0
  38.          Left            =   105
  39.          TabIndex        =   4
  40.          Top             =   420
  41.          Width           =   1815
  42.       End
  43.    End
  44.    Begin VB.CommandButton cmdPlayWave 
  45.       Caption         =   "Play"
  46.       Default         =   -1  'True
  47.       Height          =   375
  48.       Left            =   2400
  49.       TabIndex        =   2
  50.       Top             =   1470
  51.       Width           =   2055
  52.    End
  53.    Begin VB.ListBox lstWaves 
  54.       Height          =   1425
  55.       Left            =   120
  56.       Sorted          =   -1  'True
  57.       TabIndex        =   1
  58.       Top             =   360
  59.       Width           =   2055
  60.    End
  61.    Begin MSComDlg.CommonDialog dlg 
  62.       Left            =   1680
  63.       Top             =   735
  64.       _version        =   65536
  65.       _extentx        =   847
  66.       _extenty        =   847
  67.       _stockprops     =   0
  68.       cancelerror     =   -1  'True
  69.       defaultext      =   "wav"
  70.       dialogtitle     =   "Select a Wave File Directory:"
  71.       filter          =   "Wave Files (*.wav)|*.wav"
  72.       filterindex     =   1
  73.    End
  74.    Begin VB.Label lblWaves 
  75.       Appearance      =   0  'Flat
  76.       BackColor       =   &H80000005&
  77.       BackStyle       =   0  'Transparent
  78.       Caption         =   "&Wave Files.."
  79.       ForeColor       =   &H80000008&
  80.       Height          =   255
  81.       Left            =   120
  82.       TabIndex        =   0
  83.       Top             =   120
  84.       Width           =   2055
  85.    End
  86. Attribute VB_Name = "frmWaves"
  87. Attribute VB_Creatable = False
  88. Attribute VB_Exposed = False
  89. Option Explicit
  90. Private intOption As Integer
  91. Private Sub cmdPlayWave_Click()
  92.     cmdPlayWave.Enabled = False
  93.     Screen.MousePointer = vbHourglass
  94.     Select Case intOption
  95.         Case 0
  96.             PlayWaveFile lstWaves
  97.         Case 1
  98.             PlayWaveRes lstWaves
  99.     End Select
  100.     cmdPlayWave.Enabled = True
  101.     Screen.MousePointer = vbDefault
  102. End Sub
  103. Private Sub Form_Load()
  104.     LoadList 1
  105.     intOption = 1
  106. End Sub
  107. Private Sub LoadList(intOption As Integer)
  108. Dim strFiles As String
  109.     With lstWaves
  110.         .Clear
  111.         If Visible Then .SetFocus
  112.         Select Case intOption
  113.             Case 0
  114.                 On Error Resume Next
  115.                 With dlg
  116.                     .Flags = cdlOFNPathMustExist Or cdlOFNHideReadOnly
  117.                     .ShowOpen
  118.                     If Err = cdlCancel Then Exit Sub
  119.                     strFiles = Left(.filename, InStr(.filename, .FileTitle) - 1)
  120.                     ChDrive strFiles
  121.                     ChDir strFiles
  122.                 End With
  123.                 strFiles = Dir("*.wav")
  124.                 Do While Len(strFiles)
  125.                     .AddItem LCase(strFiles)
  126.                     strFiles = Dir
  127.                 Loop
  128.             Case 1
  129.                 .AddItem "Hasta"
  130.                 .AddItem "Ding"
  131.                 .AddItem "Chimes"
  132.                 .AddItem "Game"
  133.                 .AddItem "ItsBeen"
  134.                 .AddItem "RingIn"
  135.         End Select
  136.         If .ListCount Then .ListIndex = 0
  137.     End With
  138. End Sub
  139. Private Sub lstWaves_LostFocus()
  140.     cmdPlayWave.Enabled = (lstWaves.ListCount > 0)
  141. End Sub
  142. Private Sub optType_Click(Index As Integer)
  143.     LoadList Index
  144.     intOption = Index
  145. End Sub
  146.