[Lazarus] Lazarus Resources

Josh Lee frozen-dragon96 at hotmail.com
Sun Jul 25 11:28:37 CEST 2010



Josh Lee
Programmer - Owner of JLSoftware

On 25 Jul 2010, at 10:05 AM, Mattias Gaertner <nc-gaertnma at netcologne.de> wrote:

> On Sun, 25 Jul 2010 09:52:08 +0100
> Josh Lee <frozen-dragon96 at hotmail.com> wrote:
> 
>> 
>> I am now very confused. I have been told by someone on Lazarus Forums that to write an installer, I would need to use Resources. I have done some research into resources, and got this:Resource (Windows)From Wikipedia, the free encyclopedia
>> In Microsoft Windows, resources are read-only data embedded in EXE, DLL, CPL or (beginning with Windows Vista) MUI files.
>> The Windows API provides for easy access to all applications' resources.
>> [edit]TypesEach resource has a type and a name, both being either numeric identifiers or strings.
>> Windows has a set of predefined resource types:
>> Cursor and animated cursorIconBitmapDialog box templateFontHTML documentString and message templateVersion data---------------------------------------------------------
>> So it seems that I cannot store a FILE in a resource. 
>> All I wish to do is make a simple installer that installs an .exe onto the user's hard disk.
>> Thank you for the link, Mattias. It seems the page has been updated since I last saw it.
>> This is the code for my installer so far:procedure TMainForm.InstallButtonClick(Sender: TObject);beginStatusMemo.Append('Attempting to retrive file...');CRes := LazarusResources.Find('test');StatusMemo.Append('test resource found.');{So what do I do here to get the .exe stored in the resource(Compiled with Lazres) and place it on the users hard disk?}...
> 
> If you followed the wiki page you now have the file in a string. Now
> save the string to a file and set the file attributes.
> 
> 
>> Do I have some mislead conception of a 'resource'?What comes next in the code?Thanks in advance,- JoshPS. Sorry for the repeated posts, I'm having time lag and I'm posting from a crappy device
> 
> 
> Mattias
Right, so if I followed the Wiki, Data would contain a string? What would the string be?
Can resources only contain one piece of data?
What would saving a string to a file accomplish?
I have only been writing in Lazarus for half a year, and have no expertise in file I/O. 



More information about the Lazarus mailing list