Page 1 of 1
Load sound from created folder
Posted: Fri Jan 07, 2011 7:35 pm
by boyd
I created a folder with name audio and i put 1 sound in it (i don't want to put the sound in resources

)
in the mouse enter event i want to put a code to play my sound
with images work :
Code: Select all me.backgroundimage=image.fromfile("..\..\audio\sound.wav")
But how cam i make with sound?
Re: Load sound from created folder
Posted: Fri Jan 07, 2011 8:09 pm
by mandai
You can use the Windows Media Player COM control:
Code: Select all Dim wmp As WMPLib.WindowsMediaPlayer = New WMPLib.WindowsMediaPlayer()
Private Sub PictureBox1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
If wmp.playState <> WMPLib.WMPPlayState.wmppsPlaying Then
wmp.URL = "..\..\audio\sound.wav"
End If
End Sub
Re: Load sound from created folder
Posted: Fri Jan 07, 2011 8:23 pm
by boyd
I don't what in this way
It's possible in other way? without WMP?
Re: Load sound from created folder
Posted: Fri Jan 07, 2011 9:08 pm
by CleverBoy
Easy to play sound from folder : ( No Loop )
Code: Select all My.Computer.Audio.Play("c:\music folder\mouse.wav", AudioPlayMode.WaitToComplete)
to play sound for ever ( Loop ) :
Code: Select all My.Computer.Audio.Play("c:\music folder\mouse.wav", AudioPlayMode.BackgroundLoop)
Note : Change the music location between " and ",, the location that i put only example and it wont work
if i help you Give "Thanks" for me plus +Rep
Thanks
-CleverBoy
Re: Load sound from created folder
Posted: Fri Jan 07, 2011 9:16 pm
by boyd
That's the code i'm looking for.....THX CleverBoy wahooo; wahooo; wahooo; wahooo;
It works perfectly