Gdiplus::Bitmap --> Drawing::Image

Hi,

I want to create a Drawing::Image object (managed) from a Gdiplus::Bitmap object. This was my approach:

Gdiplus::Bitmap* BMP = Gdiplus::Bitmap::FromStream((IStream*)MyStream);



HBITMAP hbmp;



BMP->GetHBITMAP(*(new Gdiplus::Color(0, 0, 0)),&hbmp);



Drawing::Image^ IMG = Drawing::Image::FromHbitmap((System::IntPtr)new IntPtr((void*)hbmp));



But unfortunately

BMP->GetHBITMAP()returns 7 (Win32Error) even though it's possible to get the bitmap's image dimensions correctly. Surely the rest of the code can't work because the function call fails.

I would appreciate every comment regarding this issue,
Thanks!

[1405 byte] By [MEder] at [2007-12-22]
# 1

For GDI issues, please use the newsgroups at http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.win32.programmer.gdi&lang=en&cr=US

OTP

Thanks,

Ayman Shoukry

VC++ Team
AymanShoukry-MSFT at 2007-8-30 > top of Msdn Tech,Visual C++,Visual C++ General...
# 2
Okay, no problem.

But why isn't there a dedicated FORUM for such problems? In my opinion newsgroups are not very convenient.

MEder at 2007-8-30 > top of Msdn Tech,Visual C++,Visual C++ General...
# 3
Nobody answers at the newsgroup :(
MEder at 2007-8-30 > top of Msdn Tech,Visual C++,Visual C++ General...