Sub PlayWaveSound(fn$)
sndPlaySound 0&, SND_ASYNC ‘stop sound
DoEvents
sndPlaySound fn$, SND_ASYNC Or SND_NODEFAULT 'playsound
DoEvents
End Sub
上面的代码有时不能停止正在播放的声音,为什么?
...全文
6324打赏收藏
关于用sndplaysound停止当前声音的问题
Sub PlayWaveSound(fn$) sndPlaySound 0&, SND_ASYNC ‘stop sound DoEvents sndPlaySound fn$, SND_ASYNC Or SND_NODEFAULT 'playsound DoEvents End Sub 上面的代码有时不能停止正在播放的声音,为什么?
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (lpszSoundName As Any, ByVal uFlags As Long) As Long
Private Declare Function sndStopSound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszNull As Long, ByVal uFlags As Long) As Long
Private Declare Function midiOutClose Lib "winmm.dll" (ByVal hMidiOut As Long) As Long
Private Declare Function midiOutOpen Lib "winmm.dll" (lphMidiOut As Long, ByVal uDeviceID As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal dwFlags As Long) As Long
Private Declare Function midiOutShortMsg Lib "winmm.dll" (ByVal hMidiOut As Long, ByVal dwMsg As Long) As Long