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

GDI+ load image from IStream

143 views
Skip to first unread message

bdr529

unread,
Oct 4, 2002, 2:12:26 AM10/4/02
to
HI,

How to release IStream after creating object Image by means of
constructor Image(IStream*,...) or by means of function
Image::FromStream(IStream*,...), and why these two functions do not
release the stream and should I store the stream all the time untill
Image is use.

Thanks,

Pavel

John Hornick [MS]

unread,
Oct 4, 2002, 9:42:57 AM10/4/02
to
Hi,


Use IStream->Release() to release an IStream.

You must ensure the IStream stays alive for the life of the Image.

Thanks,
- John
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.
Visit http://www.microsoft.com/security for current information on security.

bdr529

unread,
Oct 4, 2002, 2:10:32 AM10/4/02
to
HI,

How to release IStream after creating object Image by means of
constructor Image(IStream*,...) or by means of function
Image::FromStream(IStream*,...), and why these two functions do not
release the stream and should I store the stream all the time untill
Image is use.

Thanks,

Pavel

bdr529

unread,
Oct 4, 2002, 2:08:30 AM10/4/02
to

John Hornick [MS]

unread,
Oct 8, 2002, 9:49:24 AM10/8/02
to
Hi,


You need post only once per topic - I will ignore you other duplicate
message.


If a Bitmap or Image is created from a stream or file or memory chunk,
that that stream or file or memory is "locked" by GDI+ for the life of
the Bitmap or Image. In the case of stream or memory, you must ensure
the stream or memory stay's "alive" for the life of the Image or Bitmap.

If you want to be able to release it, then you must create a new Bitmap,
and draw or memcpy() the original into the new one. Then the old Bitmap
can be disposed and the stream released.

0 new messages