Your browser doesn't support JavaScript The Windows Message Box - Windows Programming

The Windows Message Box

A message box displays a simple message to the user but may include some selection options. They are typically used to inform the user that an event has taken place. To create a message box use the API function call MessageBox. The prototype for this function is

int MessageBox(HWND hWnd,LPCTSTR lpText,LPCTSTR lpCaption,UINT uType);

where
hWnd – is a handle to the owner window of the message box to be created. If this parameter is NULL, the message box has no owner window.
LpText – The message to be displayed.
LpCaption – Contains dialog box title. If this parameter is NULL, the default title is Error
UType – defines the contents and behaviour of the dialog box and will be a combination of a number of  different flag value but some of the more common values are

 MB_ABORTRETRYIGNORE- The message box contains three pushbuttons: Abort, Retry, and Ignore.
MB_ICONEXCLAMATION-An exclamation-point icon appears in the message box.
MB_ICONERROR-A stop-sign icon appears in the message box.
MB_ICONINFORMATION – An icon consisting of a lowercase letter i in a circle appears in the message box.
MB_ICONQUESTION-A question-mark icon appears in the message box
MB_ICONSTOP- A stop-sign icon appears in the message box.
MB_OK – The message box contains one pushbutton: OK. This is the default.
MB_OKCANCEL – The message box contains two push buttons: OK and Cancel.
MB_RETRYCANCEL – The message box contains two push buttons: Retry and Cancel.
MB_YESNO – The message box contains two push buttons: Yes and No.
MB_YESNOCANCEL – The message box contains three pushbuttons: Yes, No, and Cancel.

The return value will depend on the type of message box selected but will be one of the following: IDABORT, IDCANCEL, IDCONTINUE, IDIGNORE, IDNO, IDOK, IDRETRY, IDYES

For further detailed reading
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebox

The following short program displays a very simple message box

#include <windows.h>
int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, int nCmdShow )
{
    MessageBox( NULL, "Hello, World!", "Hi!", MB_OK );
    return 0;
}