[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: Delphi .RES and version info

From: Leon Zandman <lzandman_at_lode.nl>
Date: 2005-09-21 10:02:08 CEST

Hi,

> Is there some 'good' recommended way of
> using Subversion with these resource files?

I've had lots of troubles with Delphi projects and SCM systems in a
multi-user environment in the past. Delphi automatically creates some
files that shouldn't be shared with other users, because that will give
you trouble. The files I'm talking about are the RES, DSK and CFG files.
So I never add these files to my SCM repositories. Unfortunately the
project's main RES file includes the application's main icon. So that
icon will also be lost forever.

To solve this I totally bypass the creation of the application's RES
file and manually add a .RC to my project that takes care of including
the main icon to my application. Unfortunately this has another side
effect: the addition of the application's version information will also
be skipped. So I add another .RC file to my project that contains the
version info. Now you should no longer use the project properties dialog
for changing the icon and/or the version info, but you should change the
.RC files instead.

So to sum it up:

1) Create a new application project

2) Remove the line "{$R *.res}" from the project's source (.DPR file).

3) Copy the icon you want your project to use as it's main icon into the
project's directory.

4) Create a file called "ExeIcon.RC" which should only consist of one
line:

        MAINICON ICON "icon.ico"

Note that "icon.ico" should be changed to your icon's filename.

5) Create a file called "VersionInfo.RC" with the following contents:

        1 VERSIONINFO
        FILEVERSION 1,1,1,100
        PRODUCTVERSION 1,1,1,100
        FILEOS VOS__WINDOWS32
        FILETYPE VFT_APP
        BEGIN
            BLOCK "StringFileInfo"
            BEGIN
                BLOCK "040904E4"
                BEGIN
                    VALUE "CompanyName", "Your Company Name\000"
                    VALUE "FileDescription", "Your File
Description\000"
                    VALUE "FileVersion", "1.1.1.100\000"
                    VALUE "InternalName", "Your Internal name\000"
                    VALUE "LegalCopyright", "Your Legal Copyright\000"
                    VALUE "LegalTrademarks", "Your Legal
Trademarks\000"
                    VALUE "OriginalFilename", "Your Original
Filename\000"
                    VALUE "ProductName", "Your Product Name\000"
                    VALUE "ProductVersion", "1.1.1.100\000"
                    VALUE "Comments", "Your Comments\000"
        
                    ; These values below can be removed at will
                    VALUE "PrivateBuild", "Your Private Build\000"
                    VALUE "SpecialBuild", "Your Special Build\000"
                END
            END
        
            BLOCK "VarFileInfo"
            BEGIN
                VALUE "Translation", 0x0409 0x04E4
            END
        END

Note the "\000" at the end of each resource string. I found this
necessary for most of the lines. The ones that contain a version number
can do without it, but just to be consistent I added them at the end of
every line.

6) Add both .RC files to your Delphi project. This will ensure they are
automatically compiled into .RES files when the project is built.

7) Build your project and it should all work fine!

For the above project the only files you need to check into Subversion
are:

        * Project.DPR
        * Project.DOF
        * Unit1.PAS
        * Unit1.DFM
        * Icon.ICO
        * ExeIcon.RC
        * VersionInfo.RC

I've created a sample (Delphi 6) project that uses this method. You can
download it from the following location:

        http://www.wirwar.com/BypassRES.zip

Greetings,

Leon Zandman

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Sep 21 10:04:25 2005

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.