Skip to content

Latest commit

 

History

History
114 lines (80 loc) · 3.58 KB

nf-utilapiset-beep.md

File metadata and controls

114 lines (80 loc) · 3.58 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:utilapiset.Beep
Beep function (utilapiset.h)
Generates simple tones on the speaker.
Beep
Beep function
_win32_beep
base.beep
utilapiset/Beep
base\beep.htm
Debug
ea74fe2a-759e-4466-bef4-6061643ddd26
12/05/2018
Beep, Beep function, _win32_beep, base.beep, utilapiset/Beep
utilapiset.h
Windows.h
Windows
Windows XP [desktop apps \| UWP apps]
Windows Server 2003 [desktop apps \| UWP apps]
Kernel32.lib
Kernel32.dll
Windows
19H1
Beep
utilapiset/Beep
c++
APIRef
kbSyntax
DllExport
Kernel32.dll
API-MS-Win-Core-util-l1-1-0.dll
KernelBase.dll
MinKernelBase.dll
api-ms-win-downlevel-kernel32-l1-1-0.dll
api-ms-win-core-util-l1-1-1.dll
Beep

Beep function

-description

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

-param dwFreq [in]

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

-param dwDuration [in]

The duration of the sound, in milliseconds.

-returns

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

A long time ago, all PC computers shared a common 8254 programmable interval timer chip for the generation of primitive sounds. The Beep function was written specifically to emit a beep on that piece of hardware.

On these older systems, muting and volume controls have no effect on Beep; you would still hear the tone. To silence the tone, you used the following commands:

net stop beep

sc config beep start= disabled

Since then, sound cards have become standard equipment on almost all PC computers. As sound cards became more common, manufacturers began to remove the old timer chip from computers. The chips were also excluded from the design of server computers. The result is that Beep did not work on all computers without the chip. This was okay because most developers had moved on to calling the MessageBeep function that uses whatever is the default sound device instead of the 8254 chip.

Eventually because of the lack of hardware to communicate with, support for Beep was dropped in Windows Vista and Windows XP 64-Bit Edition.

In Windows 7, Beep was rewritten to pass the beep to the default sound device for the session. This is normally the sound card, except when run under Terminal Services, in which case the beep is rendered on the client.

Examples

The following example demonstrates the use of this function.

Beep( 750, 300 );

-see-also

Error Handling Functions

MessageBeep

Notifying the User