解决方法
var td: TTaskDialog; tb: TTaskDialogBaseButtonItem; begin td := TTaskDialog.Create(nil); try td.Caption := 'Warning'; td.Text := 'Continue or Close?'; td.MainIcon := tdiWarning; td.CommonButtons := []; tb := td.Buttons.Add; tb.Caption := 'Continue'; tb.ModalResult := 100; tb := td.Buttons.Add; tb.Caption := 'Close'; tb.ModalResult := 101; td.Execute; if td.ModalResult = 100 then ShowMessage('Continue') else if td.ModalResult = 101 then ShowMessage('Close'); finally td.Free; end; end;