Solved

Playing a wav File

Posted on 1999-01-05
4
213 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
  • 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…

760 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