Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

A better beep
[ All Languages » VB »  Api]

Total Hit ( 4036)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


If you aren't satisfied with the standard Beep command (who is?) you can use the Beep API function instead, that lets you control both the frequency (in Hertz) and the duration (in milliseconds) of the beep. Note that you need an aliased Declare to avoid a name conflict with the VB command:

Click here to copy the following block
Private Declare Function BeepAPI Lib "kernel32" Alias "Beep" (ByVal dwFrequency _
  As Long, ByVal dwMilliseconds As Long) As Long

The standard Beep command has a frequency of 440 Hertz and a duration of 200 milliseconds (more or less), so you can produce a short beep with a higher pitch with the following statement:

Click here to copy the following block
BeepAPI 600, 100

And of course you can even produce more complex sounds, when a simple beep won't suffice:

Click here to copy the following block
Dim i As Long
For i = 100 To 1000 Step 10
  BeepAPI i, 20
Next


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.