home *** CD-ROM | disk | FTP | other *** search
/ Eagles Nest BBS 6 / Eagles_Nest_Mac_Collection_Disc_6.TOAST / Windows / VisBasAPIex / VBAPIGUIDE.image / MMTEST.BAS < prev    next >
BASIC Source File  |  1992-10-11  |  971b  |  43 lines

  1. Option Explicit
  2.  
  3. '
  4. ' This function plays a WAV sound file
  5. '
  6. Function PlayWAV$ (wavename$)
  7.     Dim e$, e2$
  8.     e$ = SendMMString$("Open " + wavename$)
  9.     If e$ <> "" Then
  10.         PlayWAV$ = e$
  11.         Exit Function
  12.     End If
  13.     e$ = SendMMString$("Play " + wavename$ + " wait")
  14.     e2$ = SendMMString$("Close " + wavename$)
  15.     PlayWAV$ = e$ & e2$
  16.  
  17. End Function
  18.  
  19. '
  20. '   This function sends multimedia string messages
  21. '
  22. Function SendMMString$ (cmdstring$)
  23.     Dim res%
  24.     Dim errstring As String * 128
  25.  
  26.     res% = mciSendStringAny&(cmdstring$, 0&, 0, 0)
  27.     
  28.     ' On success, just return an empty string
  29.     If res% = 0 Then
  30.         SendMMString$ = ""
  31.         Exit Function
  32.     End If
  33.  
  34.     ' On error, return the error description
  35.     res% = mciGetErrorString(res%, errstring, Len(errstring) - 1)
  36.     If res% <> 0 Then
  37.         SendMMString$ = errstring
  38.     Else
  39.         SendMMString$ = "Unknown error"
  40.     End If
  41. End Function
  42.  
  43.