playing sounds that don't exist.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi
I've found some code for playing sounds and it kinda works. This is what I have
\\\\\Public Class SoundClas
Declare Auto Function PlaySound Lib "winmm.dll" (ByVal name As String, ByVal hmod As Integer, ByVal flags As Integer) As Intege
' name specifies the sound file when the SND_FILENAME flag is se
' hmod specifies an executable file handl
' hmod must be Nothing if the SND_RESOURCE flag is not se
' flags specifies which flags are se
Public Const SND_SYNC = &H0 ' play synchronousl
Public Const SND_ASYNC = &H1 ' play asynchronousl
Public Const SND_FILENAME = &H20000 ' name is file nam
Public Const SND_RESOURCE = &H40004 ' name is resource name or ato

Public Sub PlaySoundFile(ByVal filename As String
' Plays a sound from filenam
PlaySound(filename, Nothing, SND_FILENAME Or SND_ASYNC
End Su
End Clas

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Clic
Dim SoundInst As New SoundClas
SoundInst.PlaySoundFile("C:\ringout.wav"
End Su
////////
Now pressing the button doesn't do anything I just get an error noise
If I change th
("C:\ringout.wav"
t
("ringout.wav"
it plays a sound of a phone ringing. This weird because I don't have a music file called ringout.wav
It said to use ("C:\ringout.wav") in the example on SDK but it doesn't work
 
Hi,

Actually you probably have ringout.wav in the windows\media
directory. PlaySound will check the current directory, windows directory,
windows system directory than the directories list in the path environment
for the file.

Ken
 
Back
Top