Hi Zaher,
  No that does not work either. Also within the
Result.LoadFromStream()
call at the very end there is a
Stream.Position := 0;
statement. I tried both but to no avail.

Dominique.

zaher dirkey wrote:
try
    sss.Seek(0, soFromBeginning); //<---
    Result.LoadFromStream( sss );

On Jan 27, 2008 8:45 PM, Dominique Louis <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Hi all,
      I'm using the following function to retrieve a Bitmap from a memory
    stream.

    function MyStream.ReadBitmap : TBitmap;
    // Reads a bitmap from the stream
    var
      sss : TMemoryStream;
    begin
      Result := nil;
      if not ReadBoolean then
        Exit;
      Result := TBitmap.Create;
      sss := ReadStreamC;
      try
        Result.LoadFromStream( sss );
      except
        Result.Free;
        Result := nil;
      end;
      sss.Free;
    end;

    ReadStreamC simply creates a TMemoryStream populates itself from an
    internal stream and returns the results. From what I can tell the
    TMemoryStream is fine, but the Result.LoadFromStream() call always
    throws an exception. Strangely, while running exactly the same code with
    exactly the same data file using Delphi, works fine. I am also using
    Delphi compatibility mode with Lazarus ( if that makes any difference ).

    Is anyone aware of this problem? Any Suggestions?


    Thanks,


    Dominique.

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to