?
Solved

Beep Substitute

Posted on 1998-10-06
14
Medium Priority
?
211 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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 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…
Suggested Courses
Course of the Month9 days, 21 hours left to enroll

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