腳本:
同步函數為:mciSendString
使用時首先要聲明: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
用法:
Dim filename as String
Dim cmd As String
filename = "test.wav" cmd = "open " & filename & " type WAVEAudio alias MyWav" Call mciSendString(cmd, 0, 0, 0)
Call mciSendString("play MyWav", 0, 0, 0)
異步函數為:mciSendString
使用時首先要聲明:Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA"
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
用法:
Dim filename as String
filename = "test.wav"
Call sndPlaySound(filename, SND_SYNC)
可以連續調用sndPlaySound來進行連續多個語音文件的播放。