I\'m trying to get a high resolution icon or thumbnail in Windows given a full path to that file. Doesn\'t need to be a thumbnail — a good looking Icon will be grea
If you are targeting Vista and higher, you can get a 256x256 icon from the jumbo image list. If you need to target XP, you can at least use the extra large image list, which is 48x48 (slightly better than 32x32 large).
#include
#include
HICON GetHighResolutionIcon(LPTSTR pszPath)
{
// 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_TRANSPARENT, &hico);
// Clean up
piml->Release();
// Return the icon
return hico;
}