Solved

Working with Beep

Posted on 2004-08-03
7
328 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…

776 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