Solved

sound in vb

Posted on 2000-04-24
8
210 Views
Last Modified: 2010-05-02
im using the mci32 control to play sound in my vb app, but is there a way of playiing sound where this file doesnt have to be included in the set up of this app.  can i use windows inbuilt dll to do it.  or is the multimedia control the best im gonna get?
0
Comment
Question by:gerrymcd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 1

Accepted Solution

by:
plasmatek earned 50 total points
ID: 2744531
Make a bas file and put the following in it:

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

Public Function PlayWav(wavefile As String) As boolean
    Dim lRet As Long
    lRet = sndPlaySound(wavefile, &H1 Or &H2)
End Function


then call the function like this:

dim DidItWork as boolean
DidItWork = playwav("c:\windows\media\ding.wav")





Diditwork will be false if the sound didn't play due to an error, and true if it did work. Accept this comment as an answer if it works.
0
 
LVL 1

Expert Comment

by:plasmatek
ID: 2744539
sorry...
change:
dim lret as long
to:
dim lret as boolean
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2744572
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:jsimonh33
ID: 2744991
It sounds like you are trying to embed the sound in your program. Is that your goal?

Simon
0
 
LVL 2

Author Comment

by:gerrymcd
ID: 2748754
ill try the plastek, but will all users who download the prog hadve this dll file.  is there a version which they should have for it to work?
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2748774
the package and deployment wizard will take care of everything for you.  
0
 
LVL 2

Author Comment

by:gerrymcd
ID: 2784387
ok plasteks sol worked but all activiies on the form stop when ts playing a sound, anyway to stop this?
0
 
LVL 2

Author Comment

by:gerrymcd
ID: 2822560
nie spot on it works perfectly
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question