Click to Rate and Give Feedback
MSDN
MSDN Library
Diagnostics
Error Handling
 Beep Function
Beep Function

Generates simple tones on the speaker. The function is synchronous; it performs an alertable wait and does not return control to its caller until the sound finishes.

Syntax

BOOL WINAPI Beep(
  __in  DWORD dwFreq,
  __in  DWORD dwDuration
);

Parameters

dwFreq [in]

The frequency of the sound, in hertz. This parameter must be in the range 37 through 32,767 (0x25 through 0x7FFF).

dwDuration [in]

The duration of the sound, in milliseconds.

Return Value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Muting and volume controls have no effect on Beep; you will still hear the tone. To silence the tone, use the following commands:

net stop beep
sc config beep start= disabled
Terminal Services:  The beep is redirected to the client.
Beginning with Windows Vista and Windows XP 64-Bit Edition:  This function is not supported.

Examples

The following example demonstrates the use of this function.

Beep( 750, 300 );

Requirements

ClientRequires Windows Vista, Windows XP, or Windows 2000 Professional.
ServerRequires Windows Server 2008, Windows Server 2003, or Windows 2000 Server.
HeaderDeclared in Winbase.h; include Windows.h.
LibraryUse Kernel32.lib.
DLLRequires Kernel32.dll.

See Also

Error Handling Functions
MessageBeep
Notifying the User


Send comments about this topic to Microsoft

Build date: 9/20/2008

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker