Search code examples
c++windowsstream

How to get the length of IStream? C++


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!


Solution

  • IStream::Stat should do what you want.