Once you have created or modified a resource file object there comes a time when you need to save it somewhere. To do this we simply use the SaveToFile or SaveToStream methods of TPJResourceFile.
The following code shows how to use SaveToFile:
var
ResFile: TPJResourceFile;
begin
// Assume ResFile references a valid object
...
// Save the file to 'MyResource.res'
ResFile.SaveToFile('MyResource.res');
end;
The next code snippet shows how accomplish the same thing using SaveToStream:
var
ResFile: TPJResourceFile;
Stream: TStream;
begin
// Assume ResFile references a valid object
...
Stream := TFileStream.Create('MyResource.res', fmCreate);
try
ResFile.SaveToStream(Stream);
finally
Stream.Free;
end;
end;
In real life we would just use the code in the first fragment, but this suffices as an example of using SaveToStream.
Links: