Solved

Playing a wav File

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
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.
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…
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…

734 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