Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 15th, 2012  |  syntax: None  |  size: 0.55 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Periodical tasks in Delphi app
  2. repeat
  3.   try
  4.     Application.HandleMessage;
  5.   except
  6.     Application.HandleException(Application);
  7.   end;
  8. until Terminated;//this is the Terminated property of the thread
  9.        
  10. procedure PerformThreadLoop;
  11. var
  12.   Msg: TMsg;
  13. begin
  14.   repeat
  15.     Try
  16.       while PeekMessage(Msg, 0, 0, 0, PM_REMOVE) do begin
  17.         TranslateMessage(Msg);
  18.         DispatchMessage(Msg);
  19.       end;
  20.       WaitMessage;
  21.     Except
  22.       Application.HandleException(Self);
  23.     End;
  24.   until Terminated;//this is the Terminated property of the thread
  25. end;