Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Playing a wav File

Posted on 1999-01-05
4
Medium Priority
?
284 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 60 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

886 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