I have a gdi+ bitmap, and I want to convert bitmap into HBitmap. I write the following code.
HBITMAP temp; Color color; img->GetHBITMAP(color, &temp);
But It do not work, How can I get a HBitmap?
Check the return value of the GetHBITMAP function.
Demonstration code from MSDN:
void DemonstrateGetHbitmapWithColor() { Bitmap^ bm = gcnew Bitmap( "Picture.jpg" ); IntPtr hBitmap = bm->GetHbitmap( Color::Blue ); // Do something with hBitmap. DeleteObject( hBitmap ); }