onclose 里写if application.messagebox()= OK then exit else abort;就可以了!
在Form的onCloseQuery中写 if MessageDlg('真要关闭本窗口吗?',mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes then Canclose:=true else Canclose:=FALSE;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); begin if MessageDlg('真的确定退出该系统吗?', mtConfirmation, [mbYes,mbNo], 0) = mrYes then begin Application.Terminate; end else Action := caNone; end;
在TForm的CloseQuery事件下写 procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin if application.messagebox('Do application Close?','Quit', mb_yesno+mb_defbutton1)=IDYES then CanClose:=true else CanClose:=false; end;
你是不是想在关闭自己的应用程序时弹出一个询问窗口:代码如下: onclosequery事件 canclose:=false; if application.messagebox('','',mb_okcancel+mb_defbutton1+mb_iconquestion)=idok then begin canclose:=true; end;
在TForm的CloseQuery事件下写procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); begin if MessageDlg('真的确定退出该系统吗?', mtConfirmation, [mbYes,mbNo], 0) = mrYes then begin Application.Terminate; end else Action := caNone; end;
exit
else
abort;就可以了!
Canclose:=true
else
Canclose:=FALSE;
begin
if MessageDlg('真的确定退出该系统吗?', mtConfirmation, [mbYes,mbNo], 0) = mrYes then
begin
Application.Terminate;
end else Action := caNone;
end;
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
if application.messagebox('Do application Close?','Quit',
mb_yesno+mb_defbutton1)=IDYES then
CanClose:=true
else
CanClose:=false;
end;
onclosequery事件 canclose:=false;
if application.messagebox('','',mb_okcancel+mb_defbutton1+mb_iconquestion)=idok then
begin
canclose:=true;
end;
begin
if MessageDlg('真的确定退出该系统吗?', mtConfirmation, [mbYes,mbNo], 0) = mrYes then
begin
Application.Terminate;
end else Action := caNone;
end;