Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

sound in vb

Posted on 2000-04-24
8
Medium Priority
?
224 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 200 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…
Suggested Courses

604 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