Solved

sound in vb

Posted on 2000-04-24
8
195 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
  • 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA open file from excel cell 4 42
MS Acccess - Update Field in Table when report is printed 6 44
Copy a row 12 61
How to compare ms sql hashbytes results within vb6 5 73
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

813 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now