Solved

sound in vb

Posted on 2000-04-24
8
213 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

729 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