felipe Posted November 15, 2003 Posted November 15, 2003 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? Quote
Moderators Robby Posted November 15, 2003 Moderators Posted November 15, 2003 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&) Quote Visit...Bassic Software
CattleRustler Posted November 16, 2003 Posted November 16, 2003 yes win32api as stated above ar dload and install dx9 sdk Quote mod2software Home of the VB.NET Class Builder Utility - Demo and Full versions available now!
felipe Posted November 19, 2003 Author Posted November 19, 2003 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? Quote
felipe Posted November 19, 2003 Author Posted November 19, 2003 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? Quote
fadi Posted November 19, 2003 Posted November 19, 2003 u can play the sound in a separate thread Quote
*Gurus* divil Posted November 19, 2003 *Gurus* Posted November 19, 2003 If you look up that function in MSDN you'll see there is a flag you can pass it to play the sound asynchronously. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.