Execute the following code in Delphi XE2/XE3
with TTaskDialog.Create(Self) do begin
try
if Execute then
ShowMessage('Success')
else
ShowMessage('Failed');
finally
Free;
end;
end;
No mater what button you click to close the dialog, the message shown is always Success
.
The Delphi documentation written TTaskDialog.Execute
as
Use Execute to display the Task Dialog. Execute opens the task-selection dialog, returning true when the user selects a task and clicks Open. If the user clicks Cancel, Execute returns false.