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.
Windows Vista x64 and Windows XP 64-Bit Edition: This function is not supported.
Examples
The following example demonstrates the use of this function.
Requirements
| Minimum supported client | Windows 2000 Professional |
| Minimum supported server | Windows 2000 Server |
| Header | Winbase.h (include Windows.h) |
| Library | Kernel32.lib |
| DLL | Kernel32.dll |
See Also
- Error Handling Functions
- MessageBeep
- Notifying the User
Send comments about this topic to Microsoft
Build date: 11/12/2009