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.
Requirements
| Client | Requires Windows Vista, Windows XP, or Windows 2000 Professional. |
| Server | Requires Windows Server 2008, Windows Server 2003, or Windows 2000 Server. |
|---|
| Header | Declared in Winbase.h; include Windows.h. |
| Library | Use Kernel32.lib. |
| DLL | Requires Kernel32.dll. |
See Also
Error Handling Functions
MessageBeep
Notifying the User
Send comments about this topic to Microsoft
Build date: 9/20/2008