|
-
Jul 31st, 2000, 09:54 PM
#1
Thread Starter
Member
How is sndPlaySound used?
-
Jul 31st, 2000, 10:00 PM
#2
Code:
Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Global Const SND_ASYNC = &H1
Global Const SND_NODEFAULT = &H2
Sub Playwav(file)
SoundName$ = file
wFlags% = SND_ASYNC Or SND_NODEFAULT
X% = sndPlaySound(SoundName$, wFlags%): NoFreeze% = DoEvents()
End Sub
-
Aug 1st, 2000, 10:22 AM
#3
Use PlaySound instead. It's slightly more flexible.
Code:
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Sub Command1_Click()
'Play the WAV
PlaySound "C:\MyFile.wav", 0&, &H1
End Sub
-
Aug 1st, 2000, 10:52 AM
#4
_______
<?>
Code:
'same dog different sled
'added how to stop the file from playing
' bas module code
'API Function to play the sound
'
Public Declare Function sndPlaySound Lib "winmm" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
'
' play synchronously (default)..music finishes first
Public Const SND_SYNC = &H0
' play asynchronously
Public Const SND_ASYNC = &H1
' loop the sound until next
Public Const SND_LOOP = &H8
'<<<<< form code >>>>>>>>
'this one plays and allows other events to take place
'ie form can change and music will still be playing
Private Sub Command1_Click()
Call sndPlaySound(ByVal "c:\yourfolder\yourfile.wav", SND_ASYNC)
End Sub
'to stop it you send it nothing as a parameter
Private Sub Command2_Click()
Call sndPlaySound(0,0)
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
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
|