Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

i was wondering if there was a control that would let you play a .wav file when a certain event happends?

 

i found a windows media player control but you have to open the file yourself, i'm looking for something that will act automaticly and be triggered by an event procedure.

 

is there anything like this available in VB.Net?

  • Moderators
Posted

You can use ...

Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long

'use this to play it...
PlaySound(Application.StartupPath & "\soundFile.wav", 0&, 0&)

Visit...Bassic Software
Posted

thanks a lot for the reply guys,

 

i tried the above code and set it up to a click event on the mouse,

i am getting a sound but it's a default windows sound, the one you get when an error message box shows up.

i put a try/catch block around the function call of PlaySound and it doesnt trigger anything.

 

any ideas?

Posted
ok, i fixed the last problem, one last thing though. The program is paused until the .wav file is done playing. Is there any variable or constant which can be used to control this action?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...