Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 26th, 2006, 02:48 AM
Authorized User
 
Join Date: Aug 2005
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
Default play sound file

how to play sound file on the click event of a button ???
(assume that sound file is placed in "C:\SoundFiles\MySound.wav")

also let me know, which sound formats are supported ???

 
Old July 28th, 2006, 11:26 AM
Authorized User
 
Join Date: Sep 2003
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to prabodh_mishra
Default

Private Const SND_LOOP = &H8 ' loop the sound until next sndPlaySound
Private Const SND_MEMORY = &H4 ' lpszSoundName points to a memory file
Private Const SND_ASYNC = &H1 ' play asynchronously
Private Const SND_NOSTOP = &H10 ' don't stop any currently playing sound
Private Const SND_NODEFAULT = &H2 ' silence not default, if sound not found
Private Const SND_SYNC = &H0 ' play synchronously (default)

Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Private Sub Button_Click()
    const = Either of the above given const(as per need)
    ret = sndPlaySound("C:\SoundFiles\MySound.wav", const)
End Sub


Cheers








Similar Threads
Thread Thread Starter Forum Replies Last Post
Grab a Section of a Sound File w/.NET BrianWren Pro VB.NET 2002/2003 0 January 3rd, 2008 04:23 PM
Grabbing a section of a sound file BrianWren Pro VB 6 0 January 3rd, 2008 04:21 PM
Play .wav file mvenkatesan C# 2005 3 October 22nd, 2007 07:28 AM
wav file play mvenkatesan C# 2005 1 October 17th, 2007 04:01 AM
Button doesnt play sound john111 Java Basics 0 March 7th, 2006 06:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.