Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame

Environment: VC++

Part of this class was specifically designed for all the projects out there that need an imagelist that will retrieve system file icons, just like the explorer-like example provided. CShellList is much simpler than using shell namespace objects which only bring frustation and confusion.

The other part of the class was designed to retrieve all the system file type icons. This part of the class is fixed to work with IE6 Preview Edition which created problems with SHGetFileInfo when it registered the CDF file type

Inside the class are comments on how to use the functions, and the example project should show you how to tie in the class with your project.

Updated on July 28, 2001

  • Added System Image List attaching and detaching functions
  • Fixed CDF for all preview releases of IE6


Download demo project - 28 Kb
Download source - 52 Kb


  • make it clearly

    Posted by xfrunning on 07/10/2007 11:55am

    you must make it clearly or we will not understand

  • How can i do it without MFC ??

    Posted by Legacy on 12/22/2002 08:00am

    Originally posted by: yuval

    i tried to find a win32 system call for attach method ,but could not find one .
    how can i do it without the use of CImageList ?

  • Thanks, but found a little bug in the sample

    Posted by Legacy on 12/20/2002 08:00am

    Originally posted by: Bing Mou

    The sample you provided does not initialize the COM library when start. It can be done by placing a call CoInitialize(NULL) at the beginning of InitInstance(). With out initializing the COM library, this sample won't be able to get icons of file-types that have custom icon handlers on NT based systems including Windows XP.

    File type ".cdf" is an example. The icon for this type is neither stored in the IEXPLORE.EXE nor can be retrieved from the SHELL32.DLL. There is a custom icon handler for this file type and the handler is a COM object. You have to load the icon handler and get the icon through COM interface IShellIcon and IExtractIcon. Wait, you don't have to do it your-self, Windows API SHGetFileInfo that CShellList is using knows how to deal with it. All you needs to do is to initialize the COM library, or SHGetFileInfo will return you the default file icon.

  • How do i get different icons for different exe's

    Posted by Legacy on 09/25/2002 07:00am

    Originally posted by: Gargoyle

    When using this shell list i get a standard icon for all exes what i want to do is get individual exe icons for each exe like explorer does can anybody explain how to do this. in my list control i have a seperate call for files which have the .exe extention. butdon't know how to retrive the correct icon can anyone help. Thanks in advance

  • How to get the handle to each of the images in an ImageList

    Posted by Legacy on 07/18/2002 07:00am

    Originally posted by: weiwei wang

    Hi everyone,

    I want to add several bmps to the CImageList
    and then I want to get the handle to each of
    the image in the CImageList.Do you know how to realize

    Thanks a lot. :)

  • converting .bmp to .jpg

    Posted by Legacy on 03/31/2002 08:00am

    Originally posted by: samar

    how do i convert .bmp to jpg files?

  • How do i convert .bmp files into .jpg files using VC++ programmign

    Posted by Legacy on 02/04/2002 08:00am

    Originally posted by: Rambhavan Verma

    Dear sir,
    this is rambhavan verma here.
    Please try to give me some suggestions/solutions on the above mentioned page title.
    I have to do one project on the above mentioned topic.If you can help me then try to send me some code or any suggestions on the respective topic.
    Thanking you,
    Rambhavan Verma.

  • "Great part of Codeguru"

    Posted by Legacy on 09/07/2001 07:00am

    Originally posted by: Gopidi SureshReddy

    dear Nathan Moinvaziri,

    i am regular visitor of the site.I want to know How to use Dll of VC++ in ASP,there is any build in interface or we should write interface.

    thanking you ,

    bye bye


  • Nice, but...

    Posted by Legacy on 06/26/2001 07:00am

    Originally posted by: Thomas Freudenberg

    CShellList is a fine class, but it may not show correct shell icons in some cases.
    You are able to change the standard icons used by the shell. E.g. a closed folder icon is the 3rd in shell32.dll. By setting the registry key
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons]
    you can specify a different icon. Therefore, I have added an additional method to your class:
    HICON CShellList::GetShellIcon( int nIndex )
    HICON hIcon = NULL;

    HKEY hkeyShellIcons;
    if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons"), 0, KEY_READ, &hkeyShellIcons) == ERROR_SUCCESS)
    TCHAR szBuffer[ MAX_PATH * sizeof TCHAR];
    DWORD dwSize = MAX_PATH * sizeof TCHAR;

    TCHAR szIndex[4];
    wsprintf( szIndex, _T("%d"), nIndex );
    if (RegQueryValueEx( hkeyShellIcons, szIndex, NULL, NULL, (LPBYTE)szBuffer, &dwSize) == ERROR_SUCCESS)
    CString strFile, strIndex;
    AfxExtractSubString( strFile, szBuffer, 0, _T(',') );
    AfxExtractSubString( strIndex, szBuffer, 1, _T(',') );
    ExtractIconEx( strFile, atoi(strIndex), NULL, &hIcon, 1 );

    RegCloseKey( hkeyShellIcons );

    // Add folder images
    if (!hIcon)
    ExtractIconEx(_T("SHELL32.DLL"), nIndex, NULL, &hIcon, 1);

    return hIcon;

    I have implemented it just regarding to my needs (I need the small icons only), so it neither returns a CShellList::LSICON nor it reads the large icons, but it's easy to extend.


  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date