Solved

Working with Beep

Posted on 2004-08-03
7
341 Views
Last Modified: 2010-05-02
Public Declare Function Beep Lib "kernel32" Alias "Beep" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long


I want to know how to output the beep through the pc speakers instead of the speaker inside the pc.
  Thanks a lot.
0
Comment
Question by:macaila
7 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11710355
You can use WinAPI's PlaySound() function.
0
 
LVL 1

Expert Comment

by:burnttime
ID: 11711322
You could just use...

Private Sub Form_Load()
Beep
End Sub

No need for the API
Therefore you dont need the code

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

0
 
LVL 9

Expert Comment

by:s_sansanwal
ID: 11711980
Seems your System's default sound playback is set to PC rather than Speakers
Goto Control pannel -> Sound and Audio Devices -> Audio Tab -> change "default device" under "sound playback" to speakers
0
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.

 

Author Comment

by:macaila
ID: 11712551
Private Sub Form_Load()
Beep
End Sub

that would be good if i could set the freqvency and the time but if i don't use api i can't,
the normal beep without the api is played on the pc speaker, but the beep with api is played on the speaker inside the computer,
I'm trying to play different freqvencyes to see what is my hearing range is.
0
 
LVL 7

Expert Comment

by:_agj_
ID: 11712881
maybe u shud use the directsound api.
0
 
LVL 7

Accepted Solution

by:
Burbble earned 77 total points
ID: 11714957
I knew this link would come in handy some day ;-)

http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=39362&lngWId=1

-Burbble
0
 
LVL 7

Expert Comment

by:Burbble
ID: 11804789
Thanks for the points, glad I could help.

-Burbble
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

830 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