views:

392

answers:

1

I get the System image list by calling SHGetImageList:

SHGetImageList(SHIL_LAST, IID_IImageList, (void**)&imList); 

I have a list of 256x256 images, but size of small icons which have not 256 version, have size 256 too. I need to get each icon with it's true size. How can i find out its size?

I'm get the size of an icon by using the method:

IImageList::GetIconSize

Ok. Now I know about IImageList::GetIconSize getting all icon's size equals 256x256. Then another question, how to know real image size?

p.s. Sorry for my english.

+1  A: 

An image list can only hold images of the same size. If you have a 256x256 image list, it will always return 256x256 images. To retreive images in other sizes, you need to access the other sized image lists that the Shell provides.

Remy Lebeau - TeamB
I know about it, then how to know max icon size from icon handle?
Satchitananda
The whole point of using the Shell's image list is that YOU ask the Shell to provide images in a size YOU need, and the Shell does what it has to internally to provide images in that size. If an image is available in the requested size, it is returned to you as-is. Otherwise, the Shell has to resize an image from a different size to fit your requested size. If you want to discover what sizes a file/folder natively provides, going through the Shell is not the way to do it.
Remy Lebeau - TeamB
How does one ask the shell to provide images in the size needed? As far as i can tell the SHGetImageList function only supports returning a list in one of five sizes (syssmall, small, large, extralarge and jumbo). And those sizes are not under my program's control. Is it possible to ask the shell for an image list return icons that are, say, 52x52 pixels?
Ian Boyd
No. 52x52 is a non-standard icon size. SHGetImageList() only works with standardized sizes that the OS itself operates with. If you need an icon in a specific size, then you will likely have to access the icon's raw data directly and resample the pixels as needed.
Remy Lebeau - TeamB