最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

shell - IShellItemImageFactory::GetImage returns upside down HBITMAP without negative height - Stack Overflow

programmeradmin1浏览0评论

So I got the shell enumeration working correctly, I get all the names of the items and their associated images, including both thumbnails and image icons as necessary, and it matches what I see in Explorer. However, the problem I'm facing is that icons are returned upside-down, while thumbnails are returned right side up, and nothing in the associated DIBSECTION points at a negative stride or negative height or anything of the kind (but otherwise they both store valid data that I'm using to render the images).

For an arbitrary thumbnail, I get the following:

While for an arbitrary icon I get the following:

As you can see all valid data, but the icon (the second set) is upside-down. The call that's generating this is using "bigger size ok", so it should be working correctly:

imageFactory.GetImage(new(200, 200), SIIGBF.SIIGBF_BIGGERSIZEOK, out var bitmap);

Also if I pass this HBITMAP to GDI+ it actually accounts for the upside down encoding, however I am unable to replicate it using GetObject into a DIBSECTION. What am I missing here to know when to reverse the lines without using GDI+?

NOTE: this is not a duplicate of whatever SO post you find about this, because every single working answer uses GDI+ to figure it out. This is specifically about NOT using GDI+.

发布评论

评论列表(0)

  1. 暂无评论