CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2010
    Posts
    11

    Cimagelist in clistCtrl

    Dear Sir/Madam ~

    I have a clistctrl, for each item in the list, there is a defined icon I would like to use

    itemA->iconA.ico
    itemB->iconB.ico
    itemC->iconC.ico
    ...

    long list

    How can I use those icons in my listcontrol ?


    Thank you Sir/Madam ~ very much

  2. #2
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: Cimagelist in clistCtrl

    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  3. #3
    Join Date
    Jul 2010
    Posts
    11

    Re: Cimagelist in clistCtrl

    Hmmm, I seem to get the idea of cimagelist now
    But still
    I have used Shell32 function to insert system icons (available worldwide by google, so please I am not posting it again here) into list control sucessfully, now I wonder how the clistctrl's setimagelist distinguishes each added data/file's identity to assign it an appropriate icon ?
    If I reason the same steps as you explain, I am stuck. Could Sir ovidiucuu ******** ?

    Thank you Sir ovidiucucu

  4. #4
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: Cimagelist in clistCtrl

    See CListCtrl::InsertItem and CListCtrl::SetItem.
    You will notice a parameter which is an index in the imagelist.
    See also List Items and Image Lists.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  5. #5
    Join Date
    Jul 2010
    Posts
    11

    Re: Cimagelist in clistCtrl

    Hello, ovidiucucu
    I have tried
    HICON hi=ExtractAssociateIcon(afxgetinstancehandle(),_T("C:\\windows\\shell32.dll"),&dw);
    imglisg.add(hi);

    hi contains valid value (!NULL) but I have got an assertion failure at the add function

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Cimagelist in clistCtrl

    Quote Originally Posted by Dadidum View Post
    Hello, ovidiucucu
    I have tried
    HICON hi=ExtractAssociateIcon(afxgetinstancehandle(),_T("C:\\windows\\shell32.dll"),&dw);
    imglisg.add(hi);

    hi contains valid value (!NULL) but I have got an assertion failure at the add function
    What is afxgetinstancehandle?
    What is dw?
    What is imglisg.add(hi);?


    PLease, show your actual code, not a pseudo-code.
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured