Win32 - determine if there is access to the jumbo icon

I have code to get jumbo icons from a file:

// Get the image list index of the icon
SHFILEINFO sfi;
if (!SHGetFileInfo(pszPath, 0, &sfi, sizeof(sfi), SHGFI_SYSICONINDEX)) return NULL;

// Get the jumbo image list
IImageList *piml;
if (FAILED(SHGetImageList(SHIL_JUMBO, IID_PPV_ARGS(&piml)))) return NULL;

// Extract an icon
HICON hico;
piml->GetIcon(sfi.iIcon, ILD_SCALE|ILD_TRANSPARENT, &hico);

Now the problem is that if there is no 256x256 icon associated with it in the path, I do not want the icon returned by ImageList. (It will help to take 32x32 and put it in the 256x256 icon, which I cannot use).

So, is there a way to find out if there is an icon that (will) be associated with the outline, has a large icon for it, or will 32x32 really scale? If not, I just get a regular system icon.

Note:

The final decision, inspired by Jonathan below:

HBITMAP hbitmapForFile(LPCWSTR path, int w, int h)
{
    IShellItemImageFactory *pif;    
    HBITMAP hbm;

    SIZE sz = { w, h };
    SHCreateItemFromParsingName(path, NULL, IID_PPV_ARGS(&pif));
    pif->GetImage(sz, SIIGBF_RESIZETOFIT, &hbm);
    pif->Release();
    return hbm;
}

I took the resulting one HBITMAPand placed it in the STATIC control with SS_BITMAP.

, : IShellItemImageFactory HookProc. Windows; PostMessage , .

+5
1

, - SHGetFileInfo, IShellItemImageFactory::GetImage SIIGBF_THUMBNAILONLY.

+1

All Articles