I looked on the forum and saw a post from 2005, but it is not correct with the newer juce code.
So I am asking again. How can I take a juce image and covert it and get a handle to a HBITMAP and the same idea on the MAc?

So this is what I am trying but it does not work. It actually crashes on StretchDIBits.
What am I doing wrong?

void DrawImage( Image *pImage, int x, int y, it w, int h, int desWidth, int desHeight )
::SetMapMode (m_hDC, MM_TEXT);

NativeImageType imageType;

WindowsBitmapImage *p = (WindowsBitmapImage*) &imageType;

int error = ::StretchDIBits (m_hDC, x, y, desWidth, desHeight,
               0, 0, w, h,                   p->bitmapData, (const BITMAPINFO*) &p->bitmapInfo,                   DIB_RGB_COLORS, SRCCOPY);



Well, I think the first problem is that HBITMAP isn’t available on Mac, because it’s a Windows-specific object handle.

What is it that you’re trying to do exactly?


I am trying this on Windows.
Once I know how to do this, I can figure out how to do it on Mac.