Her er en måde, hvordan du kan afspille .wav filer.
Option Explicit
Private Declare Function mciSendString Lib "winmm.dll" Alias _
"mciSendStringA" (ByVal lpstrCommand As String, _
ByVal lpstrReturnString As String, _
ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Private Sub Command2_Click()
Dim i As Long, RS As String, cb As Long
RS = Space$(128)
i = mciSendString("stop sound", RS, 128, cb)
i = mciSendString("close sound", RS, 128, cb)
End Sub
Private Sub Command1_Click()
Command2_Click
Dim i As Long, RS As String, cb As Long, W$
RS = Space$(128)
W$ = "c:\minlyd.wav"
i = mciSendString("open waveaudio!" & W$ & " alias sound", RS, 128, cb)
If i Then MsgBox "Filen blev ikke fundet!"
i = mciSendString("play sound", RS, 128, cb)
End Sub
|