Search code examples
delphiinno-setuppascalscript

How can I store a COM object in Inno Setup's TNewComboBox.Objects property?


I'm using Inno Setup to create an installer for my application. I'm currently filling a combobox (TNewComboBox) with the names of the Web sites on the current machine's IIS install. Now what I really want to do is store the COM object alongside the string in the objects property of the combo but keep getting type mismatch errors, even when wrapping the COM object in a TObject(xxx) call.

I've read in other places that the TStrings object should have an AddObject method but it doesn't seem to be present in Inno Setup/Pascal Script.


Solution

  • Delphi's TStrings class does have AddObject method but it seems that Inno's PascalScript TStrings wrapper doesn't. However, you should be able to set it like this:

      Index := Strings.Add('text');
      Strings.Objects[Index] := TObject(xxx);