title: Get window to refresh (etc) without calling Application.ProcessMessages?
body: <p>I've got a legacy app here that has a few 'time-consuming' loops that get fired off as a result of various user interaction. The time-consuming code periodically updates something on the screen with progress information (typically a label) and then, seemingly to persuade the visual refresh to happen there-and-then, the code calls Application.ProcessMessages (argh!).</p>
  
  <p>We all know now what kind of trouble this can introduce to a GUI app (being charitable, it was a more innocent time back then) and we're finding that sure as eggs, from time to time we get users achieving the impossible with the program because they're clicking on controls while the program is 'busy'.</p>
  
  <p>What's the best way of periodically refreshing the visuals of the form without taking-on other events/messages etc?</p>
  
  <p>My thoughts were to either; <br>
  - disable all of the controls before doing anything time-consuming, and leaving the '...ProcessMessages' calls in place to 'force' the refresh, or <br>
  - find another way to refresh a control periodically</p>
  
  <p>I can do the former but it left me wondering - is there a better solution?</p>
  
  <p>example code from legacy;</p>
  
  <pre>
  i:=0;
  while FJobToBeDone do
  begin
    DoStepOfLoop;
    inc(i);
    if i mod 100 = 0 then
    begin
      UpdateLabelsEtc;
      Application.ProcessMessages;
    end;
  end;
  </pre>
  
  <p>I can already hear you all fainting, at the back. :-)</p>