[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Dialogs' (#lcl)

# TCustomTaskDialog.DoExecute

Performs actions to configure and execute the dialog.

## Declaration

Source position: dialogs.pp line 791

`protected function TCustomTaskDialog.DoExecute(`
`ParentWnd: HWND`
`):Boolean; dynamic;`

## Arguments

`ParentWnd` |  | Handle for the Parent Window of the dialog.

## Function result

True if a valid button identifier was clicked in the dialog.

## Description

DoExecute is a Boolean function used to initialize and execute the task dialog form. It is called from the Execute method and uses the handle in ParentWnd as the parent form for the task dialog.

DoExecute sets the default values for properties used as return values for the dialog like ModalResult (mrNone) and QueryResult (''). It calls the Execute method in the widgetset class instance to perform the actions needed for the platform. On Windows Vista and later versions, this causes the native routines in the Win32 Task Dialog API to be called. For other platforms, including Windows versions prior to Vista, the emulated task dialog in TLCLTaskDialog is used in the widget.

Use the Flags property to specify which features or behaviors are enabled on the task dialog form.

DoExecute captures various return values from the widgetset class. These include:

- The button identifier used to close the dialog form.
- The modal result value for the button identifier used to close the form.
- The optional radio button selected on the dialog.
- The value from a query control on the dialog and its index position in the query choices.

The return value is False if the button identifier returned from the widget is a negative value. The return value is True if the dialog form was successfully displayed, and a valid button identifier was used to close the form - including when Esc, Alt+F4 or the Cancel button is used.

Remark: | This behavior is different than other LCL dialogs where a ModalResult of mrCancel would cause Execute / DoExecute to return False. This is consistent with the task dialog behavior in the Delphi VCL; the Delphi documentation states otherwise but it is incorrect.

## See also

TCustomTaskDialog.Execute |  | Displays the task dialog and captures the modal result value.
TCustomTaskDialog.Flags |  | Set of options enabled for the Task dialog.
TCustomTaskDialog.ModalResult |  | Modal result value returned when the Task dialog was executed.
TCustomTaskDialog.QueryResult |  | String representation for the query entered or selected on the dialog form.
TCustomTaskDialog.QueryItemIndex |  | Ordinal position for the value in QueryChoices selected when the task dialog is executed.
TCustomTaskDialog.Button |  | Not used in the current LCL version.
TCustomTaskDialog.RadioButton |  | The radio button selected on the Task dialog.
TLCLTaskDialog |  | Implements an emulated (non-native) task dialog form.