Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to produce a beep with the PC Speaker

Posted on 1998-08-19
14
Medium Priority
?
559 Views
Last Modified: 2010-08-05
How do I produce A beep from the PC Speaker using Visual Basic 4?  Beep produces a default wav sound (not PC speaker), MessageBeep API call does not work (gives an error of "Specified DLL function not found").
0
Comment
Question by:AlexV
[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 14

Expert Comment

by:waty
ID: 1429791
Use the Beep Statment
0
 

Author Comment

by:AlexV
ID: 1429792
As I said in the question, Beep uses the wav, not the PC Speaker.
0
 
LVL 1

Expert Comment

by:wford
ID: 1429793
why not create your own wave file beep and send that to the output?
0
Independent Software Vendors: 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 8

Expert Comment

by:MikeP090797
ID: 1429794
Maybe you've been using the wrong declaration, try this one:
Declare Function MessageBeep Lib "user32" Alias "MessageBeep" (ByVal wType As Long) As Long

0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1429795
The user can change those beeps!
0
 
LVL 3

Expert Comment

by:dapperry
ID: 1429796
I think you must have your sound card set up in a way to take all pc sounds.  Because my pc sounds are not wired to go through the sound card - the 'beep' statement works quite fine, and through the pc's speaker.

:) D Perry
0
 
LVL 12

Expert Comment

by:mark2150
ID: 1429797
Try:

Print CHR$(7);

0
 

Author Comment

by:AlexV
ID: 1429798
Chr$(7) does not seem to work.  It just prints a black line on the form.

I don't make my own wav beep because the reason I want to use the PC Speaker is because the wav output is otherwise engaged, and can not be used.

User can change the beeps, but MessageBeep(-1) gives a PC Speaker Beep.

MikeP, thanks for your comment.  It seems I had it declared wrong; the place I had it copied from had Alias "BeepA" for some reason.  It works now.  I can't *accept* your answer as it was posted as a comment, but thanks none the less.

This seems to produce a click, rather than a beep, but that is allright.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1429799
Use

Const MB_IconHand = 16

MessageBeep(MB_IconHand)

and it should work

Regards,
Viktor Ivanov
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1429800
Hey don't forget to turn on your PC Speakers =)

Regards,
Viktor Ivanov
0
 

Author Comment

by:AlexV
ID: 1429801
MessageBeep 16 is not a PC Speaker beep, it is a wav beep.  Unless that event is unassigned in the windows sounds settings, in which case it is a PC Speaker beep.
0
 

Expert Comment

by:husfloen
ID: 1429802
Well, I'd say you could use the Beep API; declared as folowing:
Declare Function Beep Lib "kernel32" Alias "Beep" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
In Windows95/98 the parametres dont matter since they are ignored anyways.

I hope this helps,
Patrik Husfloen
0
 

Author Comment

by:AlexV
ID: 1429803
Sorry, this again produces a wav beep, if assigned (I think to "Windows Default Sound") in the sounds section of control panel.
0
 

Accepted Solution

by:
TrackZero earned 140 total points
ID: 1429804
in the old visual basics you could use the sounds statement

sound [int1],[int2]

produces a sound of [int1] Hz for [int2] secs.

don't know if this still works in these newer versions and have no means to check it myself right now
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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

722 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