Can someone tell me how to use the beep api and how to get it to work
Thanx :)
Printable View
Can someone tell me how to use the beep api and how to get it to work
Thanx :)
Call Beep(Frequency,HowLong)Code:Declare Function Beep Lib "kernel32" Alias "Beep" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
i dunno what the frequency values are, the duration (HowLong) is in milliseconds. Both of those are ignored in Windows 95
When called, it makes one of those annoying sounds that you get when you push too many keys during startup
VB also has it built-in.
It's called like:
Code:Beep
I know but thats a little crap :)
In Windows NT, the dwFreq and dwDuration parameters specify the frequency and duration of the sound - I'm not sure but I think the sound comes from the PC Speaker.
In Windows 9x, the dwFreq and dwDuration parameters are ignored, and the default beep is played.
You can also check out the MessageBeep API:
This plays one of the sounds you hear in message boxes, but without displaying a message box.Code:Declare Function MessageBeep Lib "user32" (ByVal wType As Long) As Long
And it is also the only way to use the PC Speaker in Win9x:Code:Call MessageBeep(0) ' Default sound
Call MessageBeep(vbExclamation)
Call MessageBeep(vbInformation)
Call MessageBeep(vbQuestion)
Call MessageBeep(vbCritical)
Warning: The last usage is VERY annoying in a loop. :rolleyes:Code:Call MessageBeep(-1) ' Very short sound from PC Speaker - use in a loop to make it longer - can't change frequency