|
||||
BeepCategory: SystemHits: 4507 Rating: (3.84) votes 1048
Rate: 1-star 2-stars 3-stars 4-stars 5-stars
API Explanation
Beep plays a sound on the computer, but its behavior varies markedly between Win NT and Win 95/98. On Win NT, a tone is played in the specified frequency for a specified length of time. On Win 95/98, the function's two parameters are ignored completely and the function merely plays the SystemDefault sound. The function returns 1 if successful, or 0 if an error occured. Parameter Information Declare Function Beep Lib "kernel32.dll" (ByVal dwFreq As Long, _ ByVal dwDuration As Long) As Long dwFreq On Win NT, specifies the frequency, in hertz (Hz), of the tone to play. On Win 95/98, this parameter is ignored. dwDuration On Win NT, specifies the duration, in milliseconds, to play the desired tone. On Win 95/98, this parameter is ignored.
Code
'Attempt to play a note at 800 Hz for 2 seconds. This will only behave this way on Win NT; users of Win 95/98 will only hear the default sound.
Dim retval As Long ' return value retval = Beep(800, 2000) ' on NT, a 800 Hz tone for 2 seconds |