1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
const WM_MONMESSAGE = WM_USER+211;
procedure (TForm1.)STOP(var Message: TMessageRecordType); message WM_MONMESSAGE;
procedure TForm1.bnSTOPClick(Sender: TObject);
begin
ArretDemande:= True; // var globale
SendMessage(self.Handle, WM_MONMESSAGE, ...); // inutile en fait,sauf entre applis
end;
procedure longue;
begin
for i:=1 to MaxInt do begin
if i=100*trunc(i/100) then Application.ProcessMessages; // rend la main pour les messages (dont STOP.Click)
if ArretDemande then ...//
ShowMessage(IntToStr(i));
end;
end; |
Partager