title: Imageindex and stateindex in a treeview
body: <p>I coded a function that gets the list of installed software on the computer using WMI</p>
  
  <pre><code>begin
    Result:='';
    FWbemObjectSet:= FWMIService.ExecQuery(Format('Select %s from %s',[WMIProperty, WMIClass]),'WQL',wbemFlagForwardOnly);
    oEnum         := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant;
  
    while oEnum.Next(1, FWbemObject, iValue) = 0 do
      begin
        if not VarIsNull(FWbemObject.Properties_.Item(WMIProperty).Value) then
        Result:=FWbemObject.Properties_.Item(WMIProperty).Value;
        ClientForm.TreeView1.Items.AddChild(Node, Format('%s',[String(FWbemObject.Name)]));
        FWbemObject:=Unassigned;
      end;
  
  end;
  </code></pre>
  
  <p>The function get executed at FormCreate by the following code:</p>
  
  <pre><code>GETWMIstringSW('Win32_Product','Name');
  </code></pre>
  
  <p>The question I have is, How can I change the ImageIndex and StateIndex?  I want to add another line of code to the function to also get the Version, something like this</p>
  
  <pre><code>(Format('Version %s',[String(FWbemObject.Version)]));
  </code></pre>
  
  <p>But I'm stuck, can you guys please point me in the right direction?  Thank you so much.</p>