Unfortulately there is no way to convert a IWICBitmap
to a HBITMAP
, or to get one from a IWICBitmapSource
. You could, however, easily create the HBITMAP
from a pixel buffer if the format is compatible with what CreateBitmap
expects.
Assuming a 32-bit RGBA bitmap:
IWICBitmapSource *bitmap_source = some_func();
UINT width = 0, height = 0;
bitmap_source->GetSize(&width, &height);
std::vector<BYTE> buffer(width * height * 4);
bitmap_source->CopyPixels(0, width * 4, buffer.size(), buffer.data());
HBITMAP bitmap = CreateBitmap(width, height, 1, 32, buffer.data());