|
-
March 9th, 2000, 02:25 PM
#1
playing waves
does anyone know how to play wave file, WITHOUT using any special control for it (with api maybe...)?
-
March 9th, 2000, 02:32 PM
#2
Re: playing waves
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
John Pirkey
MCSD (VB6)
http://www.stlvbug.org
-
March 9th, 2000, 11:53 PM
#3
Re: playing waves
'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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|