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.
Parameters
dwFreq
The frequency of the sound, in hertz. This parameter must be in the range 37 through 32,767 (0x25 through 0x7FFF).
Windows Me/98/95: The Beep function ignores this parameter.
dwDuration
The duration of the sound, in milliseconds.
Windows Me/98/95: The Beep function ignores this parameter.
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 control 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 Me/98/95: On computers with a sound card, the function plays the default sound event. On computers without a sound card, the function plays the standard system beep.
Example Code [C++]
The following example demonstrates the use of this function.
Beep( 750, 300 );
Requirements
Client
Requires Windows Vista, Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, or Windows 95.
Server
Requires Windows Server 2008, Windows Server 2003, Windows 2000 Server, or Windows NT 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
“Muting and volume control have no effect on Beep; you will still hear the tone.”那就是笔记本主板木有Speaker了?[Quote=引用 7 楼 的回复:]
Speaker在主板上;不在声卡输出连接的喇叭上。
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 soun……
[/Quote]