Solved

Beep Substitute

Posted on 1998-10-06
14
206 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

685 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