Message box

Syntax

int mes[-](text [caption] [style] [...])

 

Parameters

text - message text. Can be string or numeric. If used more than 3 arguments, text is interpreted as format-string (see str.format).

caption - message box title. Default: "" ("QM Message").

style - message box style. See remarks. Default: "" (OK button only).

... - values that are inserted into text.

 

Options:

- on 'Cancel' and 'No' end macro. Also, ends macro if there is only OK button.

 

Remarks

Shows standard message box. Returns first character of selected button ('O' for OK, 'Y' for Yes, etc).

 

The style can be string consisting of one or more characters or substrings. Syntax:

 

"[O|OC|YN|YNC|ARI|RC|CTE][1|2|3][?|!|x|i|q|v][s][a|n][t]"

 

 O, OC, YN, YNC, ARI, RC, CTE - buttons. Default: OK.

O OK
OC OK Cancel
YN Yes No
YNC Yes No Cancel
ARI Abort Retry Ignore
RC Retry Cancel
CTE Cancel Try-Again Continue

 1, 2, 3 - default button. Default: 1.

 ?, !, x, i, q, v - icon. Default: no icon.

? question (question-mark icon). Windows Vista: no longer recommended.
! warning (exclamation-point icon).
x error (stop-sign icon).
i information (i in a circle icon).
q QM icon. In exe - exe icon.
v Vista shield icon. In older Windows versions - warning icon (same as !s). Added in QM 2.2.0.

 a, n - start active or inactive. Default: depends on "Show message box inactive" option (Options -> Run time).

 t - topmost (always on top of other windows). Has effect only if owner window is specified. If owner window is not specified, message box is topmost by default.

 s - silent. Don't play sounds.

 

style also can be an integer - MB_x flags used with MessageBox.

 

style also can be a variable of type MES.

 

type MES ~style x y timeout default hwndowner

 

style - message box style. Same as style parameter of mes.

x and y - message box coordinates. Changed are only if nonzero. If negative - relative to the screen right and/or top edge.

timeout - max time (seconds) to show the message box.

default - button to choose (e.g., 'C'), or some other value to return on timeout.

hwndowner - owner window handle. The owner window, if belongs to the same thread, will be disabled.

 

You can set only members that you need, and leave other members empty.

 

Examples

mes- "Click OK button"

mes "Missing file %s." "Error" "x" path

if(mes("Save?" "" "YN?") != 'Y') ret

MES m
m.style="YNCn"
m.x=100
m.y=1
m.timeout=15
m.default='C'
int i=mes("message" "title" m)