0

I am using MFC, now i have a bitmap object, obtained by using:

Gdiplus::Bitmap* bmp = Gdiplus::Bitmap::FromStream(pStream);

How to convert this bmp object into HBITMAP? I used :

HBITMAP hBitmap = NULL;
bmp->GetHBITMAP(Color::White, &hBitmap);

but it can't, hBitmap always return 0xcccccccc and notices that {unused=??? }. What can i do?

Tiktac
  • 966
  • 1
  • 12
  • 32

1 Answers1

0

Not a direct answer but a way to load a stream into a bitmap. It doesn't need GDI+ at all.

  1. Use CImage::Load
  2. Than use the HBITMAP conversion operator

CImage is a direct slim wrapper for a HBITMAP object from the ATL.

xMRi
  • 14,982
  • 3
  • 26
  • 59
  • Thank's xMRi, can you help me about this question? [link](http://stackoverflow.com/questions/22445645/how-to-retreive-thumbnail-on-the-device) – Tiktac Mar 17 '14 at 08:32
  • CImage is a part of ATL/MFC, which isn't available in Express editions of Visual Studio, while GDI+ is available even if you don't use VS at all... – AntonK Feb 13 '17 at 14:13