给你个简单的过程 var Form1: TForm1; IsExit:boolean=false; implementation{$R *.dfm}procedure uss; begin if IsExit then exit; end;procedure TForm1.Button1Click(Sender: TObject); begin IsExit:=not IsExit; if not IsExit then uss; end;
procedure uss; begin ... //自杀代码 sleep(1000000);//如果程序中有个这个呢 ?~`` if IsExit then exit; end; 这样正在执行也没有办法执行到最后一句不是 ..
procedure uss; begin ... //自杀代码 for i:0 to 1000 do begin sleep(1000);//如果程序中有个这个呢 ?~`` application.ProcessMessages; end; if IsExit then exit; end;
var
Form1: TForm1;
IsExit:boolean=false;
implementation{$R *.dfm}procedure uss;
begin
if IsExit then exit;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
IsExit:=not IsExit;
if not IsExit then
uss;
end;
begin
... //自杀代码
sleep(1000000);//如果程序中有个这个呢 ?~``
if IsExit then exit;
end; 这样正在执行也没有办法执行到最后一句不是 ..
begin
... //自杀代码
for i:0 to 1000 do
begin
sleep(1000);//如果程序中有个这个呢 ?~``
application.ProcessMessages;
end;
if IsExit then exit;
end;