@technipixel: You should really try to think about the code you are writing before asking why is does not work. You are typecasting streams to strings, that will defenately cause trouble. There are no issues with TMemoryStream polluting the stack since it allocates its memory on the heap. The only reason for a TMemoryStream (or any other object) to cause problems in the stack is if the objects it uninitialized. Some of your examples are trying to read past EOS, when something is written to a stream, its position will be at the end of what's written. You must code the position to be where your read operation should start ( beginning: Stream.Position:= 0; or Stream.Seek(0, soFromBeginning); ).
Also; If you want to combine textual and binary resources in a single file you must either accept the lowest level (binary) dictating the format or you must convert the lowest level to eqal the highest levet (text). Converting from binary to text (most common method being Base64) will result in a bulky and inefficient resource system that will be horrid to work with.
@GetMem + Phil: The only problems there is involved in attaching a payload to an executable is problems with signing. The process itself will not be blocked by the OS or by any antivirus since it is nothing more than copying data. Of course, you cannot/should not write to a running program since this might trigger some warnings. Executing a file that has a payload will neither cause problems unless the payload itself is an executable format - this should defenately trigger good antivirus or even the OS.
I've created sooooo many executables with resources / data attached and never, not even a single time, have I had any issues with this procedure. Some 20 years ago I've even written a TAttachedResources object which can handle both textual and binary data attached to a binary or as a standalone and it has never ever caused any trouble :-)
I'm sure the code worked for you. And I understand what it was doing.
But, I kept getting an error for the word Result (Identifier not found).
I set it as a var, but people said don't... but didn't tell how to fix it, so I removed the code.
Remember... I am trying figure out Pascal and the docs don't always help (sometimes they are wrong or outdated)
I agree... writing to an EXE isn't always good for anti-virus and OS's.
But, it doesn't mean it won't work.
I would rather of used an RES file and just embedded it into the EXE.
And I knew LAZ does it through the IDE, but I wanted to do it through code... BUT just could not find any code that created RES file using code.
Still haven't found code on creating and actual external RES file that doesn't require writing to the EXE
I want to figure out how both ways.
GetMEM offered the RES/EXE version and it works perfectly.... That is all I wanted in the beginning.
I would rather not have to create extensive code and write into an EXE the hard way.
So, hopefully I am going where I want to go.
Writing apps and saving normal files is no problem using LAZ. And using a DB isn't a problem
I am just trying to figure out the RES and RES/EXE parts of LAZ/Pascal in conjunction with creating IDE->EXE (user products)
So, I'm sorry it seems I am all over the place... but going from VB to Pascal is not a walk in the park.
