1. Herfried K. Wagner’s VB.Any
  2. .NET
  3. Frequently Asked Questions

Implementing a message box with standard behavior

Implementing a message box with standard behavior
<URL:https://dotnet.currifex.org/dotnet/faqs/custommsgbox/en/>
----------------------------------------------------------------------------

Implementing a message box with standard behavior

For the system icons:

Have a look at the 'SystemIcons' class.

For the system sounds:

\\\
Private Declare Auto Function MessageBeep Lib "user32.dll" ( _
    ByVal wType As Int32 _
) As Boolean

Private Const MB_ICONASTERISK As Int32 = &H40     ' Information.
Private Const MB_ICONEXCLAMATION As Int32 = &H30  ' Exclamation mark.
Private Const MB_ICONHAND As Int32 = &H10         ' Stop sign.
Private Const MB_ICONQUESTION As Int32 = &H20     ' Question mark.
Private Const MB_OK As Int32 = &H0                ' OK sound.
///

Usage:

\\\
MessageBeep(MB_ICONHAND)
///

Notice that Windows' message box supports copying its contents to the
clipboard by pressing Ctrl+C.

The standard message box can be extended by other controls using a Win32
hook:

A "Don't show this again" checkbox for the .NET MessageBox
<URL:http://www.codeproject.com/cs/miscctrl/MessageBoxChk.asp>