Solved

Playing a wav File

Posted on 1999-01-05
4
270 Views
Last Modified: 2011-04-14
This is probably an easy question... How do I open and play a wav file NOT using the media player looking thing.  I simply want the user to click on a command button and a specific wav file will play.  The following code is fine except it uses that lame looking media control thing

Private Sub Form_Load()
   MMControl1.Notify = False
   MMControl1.Wait = True
   MMControl1.Shareable = False
   MMControl1.DeviceType = "WaveAudio"
   MMControl1.FileName = "C:\WINDOWS\MMDATA\GONG.WAV"
   ' Open the MCI WaveAudio device.
   MMControl1.Command = "Open"
End Sub

Private Sub Form_Unload(Cancel As Integer)
   MMControl1.Command = "Close"
End Sub


0
Comment
Question by:cyber_bandit
[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
4 Comments
 
LVL 1

Author Comment

by:cyber_bandit
ID: 1454093
Edited text of question
0
 

Accepted Solution

by:
millej earned 20 total points
ID: 1454094
Declare Function sndplaysound% Lib "mmsystem" (ByVal filename$, ByVal snd_async%)

Public Sub PlaySnd()
   Dim tmp%

   tmp% = sndplaysound("C:\MySound.WAV", 1)
End Sub

0
 
LVL 1

Author Comment

by:cyber_bandit
ID: 1454095
It is telling me mmsystem not found error 48 I think it was.... looks like we are on the right track though... any more ideas?
0
 
LVL 1

Author Comment

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


This is the one (API Function) which was pointed out to me in VB6
0

Featured Post

Industry Leaders: 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!

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Suggested Courses
Course of the Month8 days, 11 hours left to enroll

617 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