减小字体
增大字体
如何播放WAV文件 '---------------------------------------------------------------- 'Author: Dr. John A. Nyhart ' 'How do I play a WAV file with VB? '---------------------------------------------------------------- '***************************************************************** Sub PlayWav(SoundName As String) Dim tmpSoundName As String Dim wFlags%, X% ' declare statements (Place in a bas module.) ''********************************** '#If Win32 Then 'Public Declare Function sndPlaySound& Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) '#Else 'Public Declare Function sndPlaySound% Lib "mmsystem.dll" (ByVal lpszSoundName As String, ByVal uFlags As Integer) '#End If 'WIN32 ' ********************************** ' WAV Sound values 'Global Const SND_SYNC = &H0 'Global Const SND_ASYNC = &H1 'Global Const SND_NODEFAULT = &H2 'Global Const SND_LOOP = &H8 'Global Const SND_NOSTOP = &H10 ' ********************************** ' *** pathWavFiles is a var with the subDir where ' the sound files are stored tmpSoundName = pathWavFiles & SoundName wFlags% = SND_ASYNC Or SND_NODEFAULT X% = sndPlaySound(tmpSoundName, wFlags%) End Sub
End of《如何播放WAV文件》
|