1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
procedure Tform1.Timer1OnTimer(Sender:TObject);
begin
if Busy then exit;
Busy:=True;
try
... traitement...
finally
Busy:=False;
end;
end;
procedure TForm1.Button1Click(Sender:TObject);
begin
if Busy then exit;
Busy:=True;
try
... début traitement...
Application.ProcessMessages;
{ si le OnTimer est déclenché, il ne fera rien (Busy=True) }
{ d'autre part, le traitement ici est suspendu pendant le traitement des messages }
... suite traitement...
finally
Busy:=False;
end;
end; |
Partager