在装载数据的程序中间加一个标志为:stop;
在装载数据时发现stop就退出操作
我都这样做! 

解决方案 »

  1.   

    kuangning: 运行中我怎么判断STOP,还是要多现成是吗?
      

  2.   

    可以用这个方法作,可能不是很好
    var
      iTime:LongInt;
    begin
      iTime:=GetTickCount;
      //处理你的程序
      repeat
        Application.ProcessMessages;
      until (GetTickCount-iTime)>=LongInt(1000);//一秒
    end;
      

  3.   

    用线程,使用Suspend and terminate方法
    在线程中调入数据,并不断检测terminated是否为true! 如是真则中断
      

  4.   

    private
      IsExit:Boolean;.
    .
    .
    procedure TForm1.Button1Click(Sender: TObject);
    begin
       For i:=0 to Query1.RecordCount-1 do
       begin
          application.ProcessMessages ;
          if IsCancel then
             break;
          ...........
          ...........
       end;
    end;
    procedure TForm1.Button2Click(Sender: TObject);
    begin
      isExit:=True;
    end;
      

  5.   

    可以利用TApplication.OnMessage事件来截获键盘发出的消息,具体可以看一看Delphi的Help文件中对这个事件的介绍。