user25749
user25749

Reputation: 4905

How to use GetHBITMAP method?

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?

Upvotes: 2

Views: 7078

Answers (2)

schnaader
schnaader

Reputation: 49729

Demonstration code from MSDN:

void DemonstrateGetHbitmapWithColor()
{
   Bitmap^ bm = gcnew Bitmap( "Picture.jpg" );
   IntPtr hBitmap = bm->GetHbitmap( Color::Blue );

   // Do something with hBitmap.
   DeleteObject( hBitmap );
}

Upvotes: 0

arul
arul

Reputation: 14084

Check the return value of the GetHBITMAP function.

Upvotes: 0

Related Questions