<HTML>
<style> BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }</style>Hi guys,<br>
<br>
<div>I too had to use such a stream.  Not so much that the stream was read-only, but the memory was already allocated for some reason.  In my case, I had a "TBufferStream", where my constructor had parameters to pass in the start address and the maximum length.</div><div><br>
</div><div>Given it seems to have many common use cases, I would say it's definitely a class worth considering.<br>
</div><br>
Gareth aka. Kit<br>
<br>
 <br>
<br>
<span style="font-weight: bold;">On Wed 13/02/19 11:12 , Yuriy Sydorov jura@cp-lab.com sent:<br>
</span><blockquote style="BORDER-LEFT: #F5F5F5 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">On 13.02.2019 11:40, LacaK wrote:
<br>

<span style="color: rgb(102, 102, 102);">> and in code I use for example:
</span><br>

<span style="color: rgb(102, 102, 102);">> 
</span><br>

<span style="color: rgb(102, 102, 102);">>      MS := TStaticMemoryStream.Create;
</span><br>

<span style="color: rgb(102, 102, 102);">>      MS.SetPointer(buffer, bufferLen);
</span><br>

<span style="color: rgb(102, 102, 102);">>      MS.Position := 0;
</span><br>

<span style="color: rgb(102, 102, 102);">>      Bitmap.LoadFromStream(MS);
</span><br>

<span style="color: rgb(102, 102, 102);">>      MS.Free;
</span><br>


<br>

Btw, you can omit "MS.Position := 0;", since it is already zero for a new stream.
<br>


<br>

Yuriy.
<br>

_______________________________________________
<br>

fpc-devel maillist  -  <a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<br>

<a target="_blank" href="<a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>"><span style="color: red;">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</span></a>
<br>

<br>

<br>

</blockquote></HTML>