Dave Murray wrote: > With your pointer and some serious thinking I finally managed to get > it figured out. I've now got the IStream copied to a TOLEStream which > enables me to work with it in Delphi. :)
You shouldn't have to copy it anywhere. Delphi has a TStream descendant that will wrap an IStream, so calls to TStream's methods are simply forwarded to the IStream's methods instead. Then you don't need to make another copy of the data. There is also a class that will go the other way -- if you have a TStream object and you need an IStream. > For some reason copying that to a TMemoryStream and then loading it > into a TJPEGImage produces an empty image even though I can see the > streams contain the correct number of bytes in the debugger. But > copying it to a TFileStream instead and then loading the file created > into a TImage works. Which is ok since I want to save a cached copy > anyway. If you already have a TOleStream (or whatever the IStream wrapper is), then you shouldn't need to copy it again into a TMemoryStream. TJpegImage merely wants a TStream -- any will do. But if you _have_ made a copy of the stream, make sure that you set its Position property back to zero before you try reading from it. Otherwise, the TJpegImage will try to read from the _end_ of the stream, where the position was left after the last write operation of the copy. > Streams and COM are not my strong points but I've definitely learned > a few things today. :D -- Rob

