That is strange. How can Stream.Seek not be implemented? Is this the exact error you are retuned?
That is strange. How can Stream.Seek not be implemented? Is this the exact error you are retuned?
Because you are using the TStream 'abstract' class - it's not meant to be used directly, It doesn't have .seek() etc implemented.
Check out TMemoryStream which will give you what you're after.
When the moon hits your eye like a big pizza pie - that's an extinction level impact event.
I have unDeleted your post (hope you don't mind) as you are partially correct.
The TStream is indeed intended to be an abstract class but it does have Seek method implemented. Infact they are two versions of Seek method implementations (Delphi XE3). One to work with 32 bit offsets and another to work with 64 bit offsets.
Now these are implemented in such way that one of tem is always called and it contains special code to check if the method was called from base class (raises an exception) or if it was overriden in one of its decendant classes.
This specific code seems pretty wierdly implemented but I sugest you take a look at it as I belive that perhaps such approach might cme usefull when designing classes.
Well not verry likely but still. It doesen't hurt to know
Thanks phibermon
I use TMemoryStream but it does't work so i try this and it works just fine...
instead load image from file with
i loaded directly to TMemoryStreamCode:LoadImageFromFile(SnapImg,myImg);
the rest i left just the same and it works...Code:strm1.LoadFromFile(SnapImg);
Thank you...
[/code]
Just looked at the TStream code and it seems that Seek method is intended to be abstract (athleast based on the in-code commentary.
But instead of it being marked as abstract where you have no method implementation it already has some code to do its job but it also has some rather strange code to check if you are calling this from base TStream or not.
Also looking at the code it is clear that TStream as such can't be used to store any data as it doesen't have any mechanizm for this.
So I'm guessing that TStream class is more like a template upon which all other streaming classes should be made.
EDIT: Documentation is confirming my guess.
The TStream class is a base stream class that all other stream classes should be derived from. So it can't be used as such as it doesen't even implement any data storing mechanizm on its own. You need to use one of the decendant stream classes.
Bookmarks