Radu MetaTrader a blogja | További ingyenes és hasznos eszközök MetaTraderhez | Kérdésed merült fel? Kérdezz!
MQL4 Könyv tartalomjegyzék | Stratégiák programozása MetaTrader platformra | Fogalomtár | Gyakran Ismételt Kérdések

MQL4 Book   Appendixes    MessageBox() Return Codes


MessageBox() Return Codes


If a message box has a Cancel button, the function returns the IDCANCEL value if either the ESC key is pressed or the Cancel button is selected. If a message box has no Cancel button, pressing ESC has no effect.

Constant
Value Description
IDOK
1
OK button was selected.
IDCANCEL
2
Cancel button was selected
IDABORT
3
Abort button was selected
IDRETRY
4
Retry button was selected
IDIGNORE
5
Ignore button was selected
IDYES
6
Yes button was selected
IDNO
7
No button was selected
IDTRYAGAIN
10
Try Again button was selected
IDCONTINUE
11
Continue button was selected

These return codes are defined in the WinUser32.mqh file, so this header file must be included in programs by #include <WinUser32.mqh>.


The MessageBox() function flags specify the contents and behavior of a dialog box. This value can be a combination of flags from the following groups of flags:

Constant Value Description
MB_OK 0x00000000 The message box contains one push button: OK. This is the default.
MB_OKCANCEL 0x00000001 The message box contains two push buttons: OK and Cancel.
MB_ABORTRETRYIGNORE 0x00000002 The message box contains three push buttons: Abort, Retry, and Ignore.
MB_YESNOCANCEL 0x00000003 The message box contains three push buttons: Yes, No, and Cancel.
MB_YESNO 0x00000004 The message box contains two push buttons: Yes and No.
MB_RETRYCANCEL 0x00000005 The message box contains two push buttons: Retry and Cancel.
MB_CANCELTRYCONTINUE 0x00000006 The message box contains three push buttons: Cancel, Try Again, Continue.

To display an icon in a message box define the additional flags:

Constant Value Description
MB_ICONSTOP
MB_ICONERROR
MB_ICONHAND
0x00000010 A stop-sign icon appears in the message box.
MB_ICONQUESTION 0x00000020 A question-mark icon appears in the message box.
MB_ICONEXCLAMATION
MB_ICONWARNING
0x00000030 An exclamation-point icon appears in the message box.
MB_ICONINFORMATION
MB_ICONASTERISK
0x00000040 An icon consisting of a lowercase letter i in a circle appears in the message box.

Default buttons are specified with the following flags:

Constant Value Description
MB_DEFBUTTON1 0x00000000 The first burron MB_DEFBUTTON1 is the default button, unless MB_DEFBUTTON2, MB_DEFBUTTON3, or MB_DEFBUTTON4 is specified.
MB_DEFBUTTON2 0x00000100 The second button is the default button.
MB_DEFBUTTON3 0x00000200 The third button is the default button.
MB_DEFBUTTON4 0x00000300 The fourth button is the default button.

MessageBox() function behavior flags are defined in the WinUser32.mqh file, this is why this heading file must be included to programs through #include <WinUser32.mqh>. Not all possible flags are listed here. For more details, please refer to Win32 API description.