Solved

Beep Substitute

Posted on 1998-10-06
14
201 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

930 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

13 Experts available now in Live!

Get 1:1 Help Now