views:

502

answers:

2

Hello, I'm creating an IStream as follow:

IStream* stream;
result = CreateStreamOnHGlobal(0, TRUE, &stream);

Then I have a CImage object that I save to this stream:

image->Save(stream, Gdiplus::ImageFormatBMP);

I need to get the size of bytes written to this IStream.

How can I do this?

There is no Length or something like this in the IStream...

thanks!

+3  A: 

IStream::Stat should do what you want.

Christopher
thanks man! worked!
Schwertz
+1  A: 

Or you can use:

    ULARGE_INTEGER liSize;
    IStream_Size(pStream, &liSize);

other functions you might find useful in this context:

    IStream_Reset(pStream);         // reset seek position to beginning
    IStream_Read(pStream, mem, size);
Harald Deischinger