Solved

Putting wavs in VB4 programs

Posted on 1998-08-31
2
136 Views
Last Modified: 2012-05-04
How can I make a wav play when I open a program?
0
Comment
Question by:Klueny2
2 Comments
 
LVL 14

Accepted Solution

by:
waty earned 50 total points
ID: 1432030
Declare Function sndPlaySound Lib "WINMM.DLL" Alias "sndPlaySoundA" _
      (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long


Const SND_SYNC = &H0  
Const SND_ASYNC = &H1  
Const SND_NODEFAULT = &H2
Const SND_LOOP = &H8  
Const SND_NOSTOP = &H10

Add the following code to the appropriate Function or Sub procedure in your application, in the main form_load, or in your main startup :

SoundName$ = "c:\windows\tada.wav"   wFlags% = SND_ASYNC Or SND_NODEFAULT
x% = sndPlaySound(SoundName$,wFlags%)
0
 

Expert Comment

by:Avi082798
ID: 1432031
The easy way is to use the "Shell" command or you can use API like waty proposed.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…

803 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