Solved

Working with Beep

Posted on 2004-08-03
7
317 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
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.

 

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

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…

920 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

11 Experts available now in Live!

Get 1:1 Help Now