谢谢

解决方案 »

  1.   

    onclose 里写if application.messagebox()= OK then 
        exit
    else 
        abort;就可以了!
      

  2.   

    在Form的onCloseQuery中写 if MessageDlg('真要关闭本窗口吗?',mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes then
      Canclose:=true
    else 
      Canclose:=FALSE;
      

  3.   

    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;
      

  4.   

    在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;
      

  5.   

    你是不是想在关闭自己的应用程序时弹出一个询问窗口:代码如下:
      onclosequery事件  canclose:=false;
     if application.messagebox('','',mb_okcancel+mb_defbutton1+mb_iconquestion)=idok then
         begin
           canclose:=true;
         end;
      

  6.   

    在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;
      

  7.   

    在onCloseQuery里写一般就可以了,除非你要防止别人terminate。