• MSComctlLib TreeView ImageList Problem loading ImageList in TreeView

    From david khurtsidze@21:1/5 to All on Thu Apr 9 08:11:41 2020
    Hi,

    Recently Started working on MSComctlLib TreeView and ImageList


    want to figure out how to use images in my TreeView, also how to set background to my TreeView object;

    using C# windows application, writing addon for sap b1 which has ActiveX support.

    so what I did
    loaded MSComctlLib.TreeCtrl.2 object
    loaded MSComctlLib.ImageListCtrl.2 object

    code snippet for ImageList

    var type = Type.GetTypeFromProgID("MSComctlLib.ImageListCtrl.2");
    var inst = Activator.CreateInstance(type) as MSComctlLib.ImageList;

    var image = Image.FromFile("Images/folder.bmp"); //tried with .png as well

    then created IPictureDisp object using
    Microsoft.VisualBasic.Compatibility.VB6 namespace

    var imgObj = Support.ImageToIPictureDisp(image);

    but when I'm trying to add imgObj to ListImages getting fatal error.

    //here
    inst.ListImages.Add(ref ind, ref key, imgObj);

    I want to create ListImage instance to use it in my TreeView ImageList instance

    looked in
    http://www.virtualsplat.com/tips/visual-basic-treeview-control.asp

    P.S. Is there any other alternative to ImageToIPictureDisp? because this library is already obsolete and working only on 32bit processes
    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From david khurtsidze@21:1/5 to All on Thu Apr 9 09:55:52 2020
    error is
    Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
    at MSComctlLib.IImages.Add(Object& Index, Object& Key, Object& Picture)
    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)