title: Loop Commands or Functions Until a Condition becomes True in Inno Setup
body: <p>I want to show a Nice Welcome Animated GIF to my users when running my Program Installer created using Inno Setup.</p>
  
  <p>I want to display some PNG Images to an order (As Inno Setup doesn't support displaying Animated GIFs yet) using <code>Isgsg.dll</code> until Setup finishes initializing my tons of codes. </p>
  
  <p>I wrote a code to show those PNG Images in order, but it stops after last one is shown.</p>
  
  <p>I need to continue showing from first PNG Image after last one shown before.</p>
  
  <p>If Setup was initialized,(I mean if <code>WizardForm</code> is visible) the Looping Procedure should stop.</p>
  
  <p>The Codes I wrote to display those PNG Images:</p>
  
  <pre><code>function InitializeSetup(): Boolean;
  var
    DlgWait: TForm;
  if Result = True then begin
  ExtractTemporaryFile('Welcome1.png');
  ExtractTemporaryFile('Welcome2.png');
  ExtractTemporaryFile('Welcome3.png');
  ExtractTemporaryFile('Welcome4.png');
  ExtractTemporaryFile('Welcome5.png');
  ExtractTemporaryFile('Welcome6.png');
  ExtractTemporaryFile('Welcome7.png');
  </code></pre>
  
  <p>&lt;&lt;&lt; LOOPING SHOULD BEGIN FROM HERE >>></p>
  
  <pre><code>ShowSplashScreen(DlgWait.Handle,ExpandConstant('{tmp}\Welcome1.png'),0250,1000,0250,0,255,True,$FFFFFF,10);
  ShowSplashScreen(DlgWait.Handle,ExpandConstant('{tmp}\Welcome2.png'),0250,1000,0250,0,255,True,$FFFFFF,10);
  ShowSplashScreen(DlgWait.Handle,ExpandConstant('{tmp}\Welcome3.png'),0250,1000,0250,0,255,True,$FFFFFF,10);
  ShowSplashScreen(DlgWait.Handle,ExpandConstant('{tmp}\Welcome4.png'),0250,1000,0250,0,255,True,$FFFFFF,10);
  ShowSplashScreen(DlgWait.Handle,ExpandConstant('{tmp}\Welcome5.png'),0250,1000,0250,0,255,True,$FFFFFF,10);
  ShowSplashScreen(DlgWait.Handle,ExpandConstant('{tmp}\Welcome6.png'),0250,1000,0250,0,255,True,$FFFFFF,10);
  ShowSplashScreen(DlgWait.Handle,ExpandConstant('{tmp}\Welcome7.png'),0250,1000,0250,0,255,True,$FFFFFF,10);
  </code></pre>
  
  <p>&lt;&lt;&lt; LOOPING SHOULD CONTINUE FROM HERE IF NOT <code>WizardForm</code> VISIBLE, OTHERWISE LOOPING SHOULD BE STOPPED >>></p>
  
  <pre><code>...
  end;
  </code></pre>
  
  <p>How can I do this as I expect?</p>
  
  <p><strong>UPDATED QUESTION</strong></p>
  
  <p>I can't think why this Code is not working.</p>
  
  <p>This DLL requires PNG File's Filename as an <code>AnsiString</code>.</p>
  
  <p>But I've provided a <code>String</code>.</p>
  
  <p>Is this gone wrong or any other Synatx Error Here for this to not working?</p>
  
  <p><code>Not Working</code> means those PNG Images Showing Loop Procedure not working.</p>
  
  <p>The Code I tried to add to do this Conditional Loop using <code>Repeat Until</code>:</p>
  
  <pre><code>function InitializeSetup(): Boolean;
  var
    DlgWait: TForm;
    IMessageHandler: TForm;
    X: Integer;
    ErrorCode: Integer;
    LblWait: TLabel;
  if Result := True then begin
  DlgWait := TForm.Create(nil);
  DlgWait.Hide;
  begin
  Order:=1;
  Repeat
  ShowSplashScreen(DlgWait.Handle,ExpandConstant('{tmp}\Welcome+IntToStr(Order)+.png'),0250,1000,0250,0,255,True,$FFFFFF,10);
  Order:=Order+1;
  Until FileExists(ExpandConstant('{tmp}\Welcome+IntToStr(Order)+.png')) = False;
  end;
  end;
  </code></pre>
  
  <p>Are there any syntax Errors?</p>
  
  <p>But Compiler doesn't give any Compiler Warning or Error.</p>
  
  <p>Thanks in Advance.</p>