Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

InvalidParameter by Bitmap::FromStream

115 views
Skip to first unread message

dot

unread,
Dec 11, 2013, 2:12:15 AM12/11/13
to
I have one .ico file, and read it into IStream, then call:
Gdiplus::Bitmap* bmp = Gdiplus::Bitmap::FromStream(pStream, TRUE);

This works on Windows7 and most Windows XP.
But on some Windows XP, bmp->GetLastStatus() after FromStream is Gdiplus::InvalidParameter.

Has anyone encountered this problem?

And here is what I want through the above code: I have one .ico file whose whole content is in memory, and want to get HBITMAP from it. Does anyone know other way to achieve this?

omar....@gmail.com

unread,
Jan 8, 2014, 7:44:44 AM1/8/14
to
I have the same problem, but in Win 7 too.

I'm using CResourceStream...

Gdiplus::Bitmap *m_pBitmap = Gdiplus::Bitmap::FromStream((IStream*)&strTruck,TRUE);

if (m_pBitmap)
{
if (m_pBitmap->GetLastStatus() == Gdiplus::Ok)
TRACE("OK");

}

delete m_pBitmap;

dot

unread,
Feb 10, 2014, 2:06:20 AM2/10/14
to
my problem solved.
I found that in some system like Windows XP, Gdiplus::Bitmap::FromStream will return false when the resource is in ico format.
At last, I wrote another function to load icon as the addition of FromStream.
If you need, I could email that code to you.
0 new messages