Pascal Scripting: TaskDialogMsgBox

Prototype:

function TaskDialogMsgBox(const Instruction, Text: String; const Typ: TMsgBoxType; const Buttons: Cardinal; const ButtonLabels: TArrayOfString; const ShieldButton: Integer): Integer;

Description:

Displays a message box using a task dialog:
Instruction specifies the instruction to display.
Text specifies the message to display.
Typ specifies which icon to display in the task dialog. If set to mbConfirmation, no icon will be displayed.
Buttons specifies which buttons to include in the task dialog.
ButtonLabels specifies which custom button labels to use. If set to an empty array, the system's default button labels will be used. If a label consists of two strings separated by a newline, then the first string specifies the button label and the second string specifies the button note.
ShieldButton specifies which button to display a shield icon on. If set to 0, no shield icon will be displayed.

Returns an ID* constant indicating the button the user clicked, or 0 if the function fails (which shouldn't happen unless an invalid parameter is specified or system resources are exhausted).

Remarks:

TMsgBoxType is defined as:

TMsgBoxType = (mbInformation, mbConfirmation, mbError, mbCriticalError);

Supported flags for Buttons are:

MB_OK, MB_OKCANCEL, MB_YESNOCANCEL, MB_YESNO, MB_RETRYCANCEL, MB_ABORTRETRYIGNORE

If MB_ABORTRETRYIGNORE is used, ButtonLabels may not be an empty array and the button labels must be specified in the following special order: Retry, Ignore, Abort.

Supported values for ShieldButton and possible return values are:

IDOK, IDCANCEL, IDRETRY, IDYES, IDNO, IDABORT, IDIGNORE

Example:
begin
  case TaskDialogMsgBox('Choose A or B',
                        'You can choose A or B.',   
                        mbInformation,
                        MB_YESNOCANCEL, ['I choose &A'#13#10'A will be chosen.', 'I choose &B'#13#10'B will be chosen.'],
                        IDYES) of
    IDYES: MsgBox('You chose A.', mbInformation, MB_OK);
    IDNO: MsgBox('You chose B.', mbInformation, MB_OK);
  end;
end;
See also:

SuppressibleTaskDialogMsgBox
MsgBox