Solved

Putting wavs in VB4 programs

Posted on 1998-08-31
2
134 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

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

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

762 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

23 Experts available now in Live!

Get 1:1 Help Now