danbars
March 9th, 2000, 01:25 PM
does anyone know how to play wave file, WITHOUT using any special control for it (with api maybe...)?
|
Click to See Complete Forum and Search --> : playing waves danbars March 9th, 2000, 01:25 PM does anyone know how to play wave file, WITHOUT using any special control for it (with api maybe...)? Johnny101 March 9th, 2000, 01:32 PM Like this: '--[Form1.frm]------------------------ option Explicit Const pathWavFiles = "C:\WinNT\Media\" private Sub Command1_Click() PlayWav "tada.wav" End Sub Sub PlayWav(SoundName as string) Dim tmpSoundName as string Dim wFlags%, X% tmpSoundName = pathWavFiles & SoundName wFlags% = SND_ASYNC Or SND_NODEFAULT X% = sndPlaySound(tmpSoundName, wFlags%) End Sub '------------------------------------- '--[Module1.bas]---------------------- ' 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 #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 '------------------------------------- hope this helps, John John Pirkey MCSD www.ShallowWaterSystems.com The Matrix March 9th, 2000, 10:53 PM 'forms declarations: Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA"(ByVal lpszSoundName as String, ByVal uFlags as Long) As Long 'CODE Dim filename as String Dim rc as Long filename = "C:\windows\media\the microsoft sound.wav" rc = sndPlaySound(filename, 1) ' put that peave of code ^ there in whatever you want when to play the wave file Subzero codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |