如何在关闭查询时关闭应用程序之前提示用户两次?只是为了确保用户了解他/她将要做的事情......
答案 0 :(得分:2)
只显示两个MessageDlg:
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
CanClose := False;
if MessageDlg('Are you sure ?', mtConfirmation, mbYesNo, 0) = mrYes then
begin
if MessageDlg('I think you underestimate the value of the question I just ask.' + #13 + #10 + 'Are you REALLY SURE you want to quit ?', mtConfirmation, mbYesNo, 0) = mrYes then
begin
CanClose := True;
end;
end;
end;
但请注意,要求两次确认是完全浪费时间。您的用户最终会快速点击两次,这会使他们烦恼而不会增强您的应用程序“安全性”...