[fpc-pascal] fcl-res: using resource embedded in exe

Paul Ishenin paul.ishenin at gmail.com
Mon May 27 01:04:55 CEST 2013


25.05.13, 20:25, Reinier Olislagers пишет:

> In the code above, I'm loading the resource from the executable.
> However, Paramstr(0) is not reliable on all platforms.
> Is there a better way of doing this?

Yes.

Resource := FindResource(HInstance, 'SQLSCRIPT', RT_RCDATA);
if Resource <> 0 then
begin

   Stream := TResourceStream.Create(HInstance, 'SQLSCRIPT', RT_RCDATA);
   ...
end;

TResourceStream is available cross platform in classes.pas unit.

Best regards,
Paul Ishenin



More information about the fpc-pascal mailing list