ListView ImageList problem (MFC)

This is a discussion on ListView ImageList problem (MFC) within the Windows Programming forums, part of the Platform Specific Boards category; I have a problem with initializing an image list for a listview. I'm using MFC with doc/view. The problem is ...

  1. #1
    Registered User The Dog's Avatar
    Join Date
    May 2002
    Location
    Cape Town
    Posts
    788

    ListView ImageList problem (MFC)

    I have a problem with initializing an image list for a listview. I'm using MFC with doc/view. The problem is that when I try and retrieve the image list, with the SHGFI_SMALLICON flag enabled, I get a debugging error.

    If i just use SHGFI_ICON, then it works fine, but then i don't get the small icons.

    Here's my code:
    Code:
    SHFILEINFO ssfi;    
    	
    m_ilSmall.Attach((HIMAGELIST)SHGetFileInfo( 
    	"c:\\",
    	0, 
    	&ssfi, 
    	sizeof(SHFILEINFO), 
    	SHGFI_SYSICONINDEX | SHGFI_ICON));
    
    DestroyIcon(ssfi.hIcon);
    If I used SHGFI_SMALLICON instead, then i get an error message.

    I attached a zip file of two pics of the error message and the working prog, but with large icons.

  2. #2
    Registered User The Dog's Avatar
    Join Date
    May 2002
    Location
    Cape Town
    Posts
    788
    Well, thanks for all the replies , but i found the problem.

    The treeview's imagelist was being initialized first, which i attached to the system's imagelist, so when i tried to attach the listview imagelist to the same thing, I got a debugging error.

    I solved the problem by making the listview's imagelist point to the treeviews imagelist.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 03:51 PM
  2. MFC Dialog Problem
    By prongs_386 in forum Windows Programming
    Replies: 1
    Last Post: 05-10-2007, 01:25 AM
  3. Problem with MFC Wizard
    By okinrus in forum Windows Programming
    Replies: 1
    Last Post: 04-10-2004, 05:09 PM
  4. WIndows programming?
    By hostensteffa in forum Windows Programming
    Replies: 7
    Last Post: 06-07-2002, 09:52 PM
  5. MFC ListView and EditBox Data
    By mangoz in forum Windows Programming
    Replies: 0
    Last Post: 04-21-2002, 11:51 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21