Implementing a Message Box with Standard Behavior
The system icons can be accessed via the SystemIcons
class.
The system sounds can be played via P/Invoke:
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)
The keyboard shortcut Ctrl+C copies the contents of message boxes to the clipboard.
The standard message box can be extended by additional controls using a Win32 hook: A “Don’t show this again” checkbox for the .NET MessageBox
.