Cimagelist in clistCtrl
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Cimagelist in clistCtrl

  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
    ovidiucucu's Avatar
    ovidiucucu is offline Moderator/Reviewer Power Poster
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,027

    Re: Cimagelist in clistCtrl

    Ovidiu Cucu
    "When in Rome, do as Romans do."
    Visit: Microsoft Virtual Academy
    Follow: https://twitter.com/#!/ovidiucucu
    My blog: http://codexpert.ro/blog/author/ovidiu-cucu/

  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
    ovidiucucu's Avatar
    ovidiucucu is offline Moderator/Reviewer Power Poster
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,027

    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 Cucu
    "When in Rome, do as Romans do."
    Visit: Microsoft Virtual Academy
    Follow: https://twitter.com/#!/ovidiucucu
    My blog: http://codexpert.ro/blog/author/ovidiu-cucu/

  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 online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,423

    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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center