title: Correct way to add items to a list box in Inno Setup?
body: <p>I got a code from <a href="https://stackoverflow.com/questions/44167016/list-all-physical-printers-using-wmi-query-in-inno-setup">List all physical printers using WMI query in Inno Setup</a> and I want to add the results to a list box. I have tried to do it before asking, but I just can't add all items. This is an my code:</p>
  
  
  
  <pre class="lang-pascal prettyprint-override"><code>var
    Query, AllPrinters: string;
    WbemLocator, WbemServices, WbemObjectSet: Variant;
    Printer: Variant;
    I: Integer;
  begin
    WbemLocator := CreateOleObject('WbemScripting.SWbemLocator');
    WbemServices := WbemLocator.ConnectServer('.', 'root\CIMV2');
    Query := 'SELECT Name FROM Win32_Printer';
    WbemObjectSet := WbemServices.ExecQuery(Query);
    if not VarIsNull(WbemObjectSet) and (WbemObjectSet.Count &gt; 0) then
    begin
      for I := 0 to WbemObjectSet.Count - 1 do
      begin
        Printer := WbemObjectSet.ItemIndex(I);
        if not VarIsNull(Printer) then
        begin
          Log(Printer.Name);
          AllPrinters := Printer.Name;
        end;
      end;
    end;
  end;
  </code></pre>
  
  <p>Then on a custom page do this:</p>
  
  <pre class="lang-pascal prettyprint-override"><code>ListBoxPrinters.Items.Add(AllPrinters);
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/iSrAB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iSrAB.png" alt="enter image description here"></a></p>