Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 26th, 2006, 02:48 AM
Authorized User
Join Date: Aug 2005
Location: , , .
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 ???

Reply With Quote
  #2 (permalink)  
Old July 28th, 2006, 11:26 AM
Authorized User
Join Date: Sep 2003
Location: Delhi, Delhi, India.
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to prabodh_mishra

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


Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 06:28 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.