Page 1 of 1

Ressources Files

Posted: Fri Mar 25, 2016 9:00 am
by loulou2522
Hi all,
I find how to write a description of my exe in the ressource file of my executable ?
THanks in advance

Re: Ressources Files

Posted: Fri Mar 25, 2016 9:10 pm
by Lunasole
I can tell only general steps, without concrete examples (cause was too lazy and didn't tested it yet with any my program, except I was adding icons to DLL similar way).

1. First you need to compose resource script (.rc). It is plain text file by fact and can be made in notepad++
2. Then you need to describe VERSIONINFO block withing this script
3. At last, goto "Compiler Options > Resources" and add your script here

For resources Purebasic uses PORC.exe utility taken from Pelles C IDE. I suggest you download Pelles C and look help file from it for more details.


UPD. Just tried the following stuff and it worked, but should be misses some fields. Save it as .rc file and try.

Code: Select all

1 VERSIONINFO

FILEVERSION 2,50,0,0
PRODUCTVERSION 2,50,0,0
{
    BLOCK "StringFileInfo"
    {
        BLOCK "040904B0"  /* U.S. English, Unicode */
        {
            VALUE "CompanyName", "More Bucks Than Always\0"
            VALUE "FileDescription", "One really cool application\0"
            VALUE "FileVersion", "2.50\0"
            VALUE "LegalCopyright", "Copyright (c) More Bucks Than Always 2007\0"
            VALUE "ProductName", "Cool application for professionals\0"
            VALUE "ProductVersion", "2.50\0"
            VALUE "InternalName", "coolapp\0"
            VALUE "OriginalFilename", "coolapp.exe\0"
        }

        BLOCK "041D04B0"  /* Swedish, Unicode */
        {
            /* as above, in Swedish... */
        }

    }

    BLOCK "VarFileInfo"

    {
        VALUE "Translation", 0x409, 0x4B0  /* U.S. English, Unicode */
        VALUE "Translation", 0x41D, 0x4B0  /* Swedish, Unicode */
    }
}

Re: Ressources Files

Posted: Fri Jul 01, 2016 6:21 pm
by NoahPhense
Are there benefits of using Pelles over the PB method for dealing with resource files?

- np

Re: Ressources Files

Posted: Fri Jul 01, 2016 6:48 pm
by Lunasole
NoahPhense wrote:Are there benefits of using Pelles over the PB method for dealing with resource files?

- np
What PB does is the same as those RC scripts by fact, just more easy to use and with some restrictions sometime.
By using resource scripts you can set anything, any custom resource to be included into exe and so on.

For example, once I needed to add icon to my .dll. But when I set this icon in IDE params, it was not included to resulting DLL for some reasons.
That was fixed by using simple RC script

Code: Select all

1 ICON file.ico

But well, those resource files are Windows-specific and I don't think they should be right way to manage resources nowadays ^^
Should be better to use something custom and x-platform [XML for example] to define external program resources (like translations, strings).
But if you want to store all the stuff inside executable file with ability to edit or replace that stuff after executable already compiled (using some resource editor), there is no other way than to use .RES files or .RC scripts [or writing something custom to work with raw exe binary ^^]. PB currently only offers IncludeBinary for this, which works different way.

Re: Ressources Files

Posted: Fri Jul 01, 2016 7:02 pm
by NoahPhense
I usually only use the resource section in PB for info/version-data and the primary icon. Anything else that I am including, binary or otherwise, will be included into the binary.

I have Pelles installed. I'll mess with it a bit to see if there are any benefits to my workflow.

- np