Ressources Files

Just starting out? Need help? Post your questions and find answers here.
loulou2522
Enthusiast
Enthusiast
Posts: 552
Joined: Tue Oct 14, 2014 12:09 pm

Ressources Files

Post by loulou2522 »

Hi all,
I find how to write a description of my exe in the ressource file of my executable ?
THanks in advance
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: Ressources Files

Post 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 */
    }
}
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

Re: Ressources Files

Post by NoahPhense »

Are there benefits of using Pelles over the PB method for dealing with resource files?

- np
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: Ressources Files

Post 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.
Last edited by Lunasole on Fri Jul 01, 2016 7:08 pm, edited 2 times in total.
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

Re: Ressources Files

Post 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
Post Reply