home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / p / ptv3n5.zip / VBWAVE.ZIP / PLAYFRM.TXT < prev    next >
Text File  |  1992-10-14  |  3KB  |  104 lines

  1. Const SYSTEMSOUND = 0
  2. Const WAVEFILE = 1
  3.  
  4. Dim CurrentSound As String
  5. Dim CurrentType As Integer
  6.  
  7.  
  8. Sub Form_Load ()
  9.     OK% = sndPlaySound("SystemStart", SND_SYNC + SND_NODEFAULT)
  10.     PlaySnd.SysSoundList.AddItem "SystemAsterisk"
  11.     PlaySnd.SysSoundList.AddItem "SystemHand"
  12.     PlaySnd.SysSoundList.AddItem "SystemDefault"
  13.     PlaySnd.SysSoundList.AddItem "SystemExclamation"
  14.     PlaySnd.SysSoundList.AddItem "SystemQuestion"
  15.     PlaySnd.SysSoundList.AddItem "SystemExit"
  16.     PlaySnd.SysSoundList.AddItem "SystemStart"
  17. End Sub
  18.  
  19. Sub PlayButton_Click ()
  20. Dim Msg As String, CrLf As String, WaveError As Integer
  21.  
  22.     WaveError = FALSE
  23.     CrLf$ = Chr$(13) + Chr$(10)
  24.  
  25.     If CurrentSound$ = "" Then
  26.         WaveError = TRUE
  27.         Msg$ = "There is no sound selected."
  28.     End If
  29.     If (CurrentType% = WAVEFILE) And
  30.        (Right$(UCase$(CurrentSound$), 3) <> "WAV") Then
  31.         WaveError = TRUE
  32.         Msg$ = "The current file: " + CurrentSound$ + CrLf$
  33.         Msg$ = Msg$ + "is not a valid waveform file." + CrLf$
  34.         Msg$ = Msg$ + "Only files with a .WAV extension" + CrLf$
  35.         Msg$ = Msg$ + "can be selected."
  36.     End If
  37.     If Not WaveError Then
  38.         Worked% = sndPlaySound(CurrentSound$, SND_SYNC)
  39.     End If
  40.     If Worked% = FALSE Then
  41.         WaveError = TRUE
  42.         Msg$ = "Couldn't find the requested .WAV file."
  43.     End If
  44.     If WaveError Then
  45.         MessageBeep (MB_ICONINFORMATION)
  46.         MsgBox Msg$, MB_ICONINFORMATION, "sndPlaySound Error"
  47.     End If
  48. End Sub
  49.  
  50. Sub ExitButton_Click ()
  51.     OK% = sndPlaySound("SystemExit", SND_SYNC + SND_NODEFAULT)
  52.     End
  53. End Sub
  54.  
  55. Sub WaveFileList_Click ()
  56.     CurrentType% = WAVEFILE
  57.     CurrentSound$ =
  58.       FullPathName$(WaveFileList.Path, WaveFileList.FileName)
  59.     lblCurrentSound.Caption = CurrentSound$
  60. End Sub
  61.  
  62. Function FullPathName$ (ByVal PathName$, ByVal FileName$)
  63.     If Right$(PathName$, 1) <> "\" Then
  64.         PathName$ = PathName$ + "\"
  65.     End If
  66.     FullPathName$ = PathName$ + FileName$
  67. End Function
  68.  
  69. Sub WaveFileList_DblClick ()
  70.     CurrentType% = WAVEFILE
  71.     CurrentSound$ =
  72.       FullPathName$(WaveFileList.Path, WaveFileList.FileName)
  73.     lblCurrentSound.Caption = CurrentSound$
  74.     PlayButton.Value = TRUE
  75. End Sub
  76.  
  77. Sub Dir1_Change ()
  78.     WaveFileList.Path = Dir1.Path
  79. End Sub
  80.  
  81. Sub Command1_Click ()
  82.  
  83. End Sub
  84.  
  85. Sub SysSoundButton_Click ()
  86.     If SysSoundList.ListIndex <> -1 Then
  87.         CurrentSound$ = SysSoundList.List(SysSoundList.ListIndex)
  88.     End If
  89. End Sub
  90.  
  91. Sub SysSoundList_Click ()
  92.     CurrentType% = SYSTEMSOUND
  93.     CurrentSound$ = SysSoundList.List(SysSoundList.ListIndex)
  94.     lblCurrentSound.Caption = CurrentSound$
  95. End Sub
  96.  
  97. Sub SysSoundList_DblClick ()
  98.     CurrentType% = SYSTEMSOUND
  99.     CurrentSound$ = SysSoundList.List(SysSoundList.ListIndex)
  100.     lblCurrentSound.Caption = CurrentSound$
  101.     PlayButton.Value = TRUE
  102. End Sub
  103.  
  104.