how to control the pc speaker in vba

jackal575

New member
Local time
Tomorrow, 04:51
Joined
Feb 12, 2005
Messages
8
i would like to make a reoccurring beep from vba. i would have used the docmd.beep command but you have to have speakers hooked up to hear it so how could do the same thing using the pc speaker?
 
The attached "ReoccurringBeepingWithAnimation.zip" sample will show you how easy it is to do it using the forms timer event and the beeping plays through a computer that only has the built-in PC speaker. This will certainly drive your users nuts. I added it to a form that also shows you how to add a simple animation effect to your db.
 

Attachments

The reoccuring beep animation doesn't work for me on Win2k...

Jackal if you really want a beep put this in a module:


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


Call it from anywhere with:
Beep <pitch>,<length>

a good starting place is something like:
Code:
Beep 150,100

The higher you go, the higher the pitch and the longer the length. Play with it... you can actually make some cool songs/apps using variables. Enjoy.

-modest
 
The reoccuring beep animation doesn't work for me on Win2k...
Odd but I have heard a lot of things do not work for Access 2000.

But the "ReoccurringBeepingWithAnimation.zip" sample does work in Access 97 and Access 2003 for me.

I do like the beep API you posted for I had never seen that one before.

Anybody care to post any composed "beep" songs?
 
I had a keyboard I made out of it once...

The animation worked in your db... I just didn't get the Beep on my Work machine using Win2k, A2K3

However, it did work on my home machine using WinXPro A2K3
 
yeh, the beep in that didnt work quite as planned but its still cool. modest, that is just what i was looking for! thank you. i have just got this thing working and i have now circulated it around on teh school network so that whenever im bored, i can open it up and piss off the teachers lol :D

if i could only learn how to block out the break command :D
 

Attachments

Last edited:

Users who are viewing this thread

Back
Top Bottom