3

I want to use IShellItemImageFactory to retrieve the shell thumbnail of files. According to the MSDN docs, if I pass in a SIZE struct of 256x256, it should populate the HBITMAP parameter with a 256x256 bitmap, and if I use the SIIGBF_RESIZETOFIT flag, it should resize smaller thumbnails to 256x256. It doesn't. Instead, the result is a 256x256 bitmap with a small icon drawn in the middle.

Okay, maybe that's just not what SIIGBF_RESIZETOFIT is supposed to do. But then, as I understand it, I should be able to use SIIGBF_BIGGERSIZEOK and specify a tiny size (say 1x1) and it should return the actual thumbnail size instead. It doesn't. I always get whatever size I pass in.

Am I using this API incorrectly, or is it just broken? There seem to be very few examples on the web. A few discussion posts have people suggesting the API is broken. If it is indeed broken, how can I determine if a given shell item has a thumbnail? That way, I can use this method to get thumbnails and extract the icon otherwise.

Matthew Olenik
  • 3,577
  • 1
  • 28
  • 31
  • 1
    Use SIIGBF_THUMBNAILONLY to check if a thumbnail is available. – Hans Passant Dec 21 '09 at 12:37
  • Another thing to watch out for is that the API sometimes returns bitmaps that use pre-multiplied alpha and sometimes ones that use normal alpha, with no proper way (except heuristics, which can go wrong) to tell which. It's a pretty poor API. :( – Leo Davidson Dec 13 '10 at 20:12

1 Answers1

1

Have you seen http://mattolenik.spaces.live.com/?_c11_BlogPart_BlogPart=blogview&_c=BlogPart&partqs=cat%3D.NET

I've tried it and it seems to work well

Homde
  • 4,246
  • 4
  • 34
  • 50