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

Plays a waveform sound. The waveform sound for each sound type is identified by an entry in the registry.

Syntax

C++
BOOL WINAPI MessageBeep(
  __in  UINT uType
);

Parameters

uType [in]

The sound to be played. The sounds are set by the user through the Sound control panel application, and then stored in the registry.

This parameter can be one of the following values.

ValueMeaning
-1

A simple beep. If the sound card is not available, the sound is generated using the speaker.

MB_ICONASTERISK
0x00000040L

See MB_ICONINFORMATION.

MB_ICONEXCLAMATION
0x00000030L

See MB_ICONWARNING.

MB_ICONERROR
0x00000010L

The sound specified as the Windows Critical Stop sound.

MB_ICONHAND
0x00000010L

See MB_ICONERROR.

MB_ICONINFORMATION
0x00000040L

The sound specified as the Windows Asterisk sound.

MB_ICONQUESTION
0x00000020L

The sound specified as the Windows Question sound.

MB_ICONSTOP
0x00000010L

See MB_ICONERROR.

MB_ICONWARNING
0x00000030L

The sound specified as the Windows Exclamation sound.

MB_OK
0x00000000L

The sound specified as the Windows Default Beep sound.

 

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

After queuing the sound, the MessageBeep function returns control to the calling function and plays the sound asynchronously.

If it cannot play the specified alert sound, MessageBeep attempts to play the system default sound. If it cannot play the system default sound, the function produces a standard beep sound through the computer speaker.

The user can disable the warning beep by using the Sound control panel application.

Terminal Services:  To send a beep to a client, use the Beep function. The Beep function is redirected to the client, whereas MessageBeep is not.

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinuser.h (include Windows.h)
LibraryUser32.lib
DLLUser32.dll

See Also

Beep
Error Handling Functions
FlashWindow
Notifying the User

Send comments about this topic to Microsoft

Build date: 7/30/2009

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
vb.net syntax      dmex   |   Edit   |   Show History
<DllImport("user32", CharSet:=CharSet.Unicode, SetLastError:=True)> _
Public Shared Function MessageBeep(ByVal uType As Integer) As Integer
End Function
Tags What's this?: Add a tag
Flag as ContentBug
C# syntax      dmex ... Thomas Lee   |   Edit   |   Show History
[DllImport("user32", CharSet=CharSet.Unicode, SetLastError = true)]
internal static extern int MessageBeep(int uType);
Tags What's this?: c# (x) syntax (x) Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker