Solved

Beep Substitute

Posted on 1998-10-06
14
200 Views
Last Modified: 2010-04-30
How do I make a click sound in VB, in place of the Beep
0
Comment
Question by:lewiss
14 Comments
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1438442
You can use sndPlaySound API to play any .wav file. Since you haven't specified VB version you are using, you will have to get the declaration from Api text viewerv, located at \VB\Winapi
0
 

Author Comment

by:lewiss
ID: 1438443
How do I call it in VB5?  
0
 
LVL 3

Expert Comment

by:TheAnswerMan
ID: 1438444
PUT THIS WITH YOUR GLOBALS>>>
Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long


THEN>>> when you want to play the sound...
call sndPlaySound("C:\PathName.wav",0)
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1438445
MessageBeep(mb_Ok);

//Vik
0
 

Author Comment

by:lewiss
ID: 1438446
I'm sorry, but I don't want to play a WAV file.  I want an
audible "click" or some short pleasant sound to replace the
beep.
0
 
LVL 10

Accepted Solution

by:
viktornet earned 50 total points
ID: 1438447
Public Declare function MessageBeep Lib "user32.dll"(ByVal uType As Long) as Boolean

const MB_ICONASTERISK = 64
const MB_ICONEXCLAMATION = 48
const MB_ICONHAND = 16
const MB_ICONQUESTION = 32
const MB_OK = 0

YOu can call any of those sounds as follows...

call MessageBeep(MB_ICONHAND)

That's all..hope you enjoy it...

Regards,
Viktor Ivanov
0
 

Author Comment

by:lewiss
ID: 1438448
I only get beeps and clunks from the constants given for the messagebeep routine.  Useful information but not what I was hoping for.  Thanks for the effort.


0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 10

Expert Comment

by:viktornet
ID: 1438449
There are some other constant sounds in Windows so try searching for them, and find out what the constants for those sounds are do you can play it... There is also a click but I don't temember the constant for that sound....try searching for 'em...

Regards,
Viktor Ivanov
0
 

Author Comment

by:lewiss
ID: 1438450
Is there any way that I can sub-class the beep function? I've
tried entering various values but keep getting the standard
beep.

Declare Function Beep Lib "kernel32" Alias "Beep" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1438451
You want to use Bepp() instead of MessageBeep() ????
0
 

Author Comment

by:lewiss
ID: 1438452
What is Bepp()? It's not in the api list.  How would you use
it?
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1438453
Sorry..... I meant Beep()
0
 

Author Comment

by:lewiss
ID: 1438454
Yes. How do I subclass it?  
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1438455
I'm not sure but what do you mean by subclass it??? I'm not exactly a VB programmer so I don't know the term you've used.

Regards,
Viktor Ivanov
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

758 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

22 Experts available now in Live!

Get 1:1 Help Now