Using our own resource file?

Hi! I don’t know if this is still of interests… I tried the same: change the version infos created by the resource.rc.
The macro JUCE_USER_DEFINED_RC_FILE does not work because the resource-compiler has no configurable defines in the projucer.
I have solved this problem by replacing the resource.rc file by an own one:
Simply create an own .rc file like “userdefinedrcfile.rc” at the same location as resources.rc (in builds\VisualStudioxxx) and add the folowing into the “pre-build command” of each configuration:
"copy userdefinedrcfile.rc resources.rc"
In your own .rc file you can use #includes etc to use defines also.
In my case something like that:

#include <windows.h>
#include "…/…/Info.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_MAJ, VERSION_MIN, 0, VERSION_BUILDNR
PRODUCTVERSION VERSION_MAJ, VERSION_MIN, 0, VERSION_BUILDNR
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904e4"
BEGIN
VALUE “FileVersion”, VERSIONINFO_VERSION_STRING "\0"
VALUE “ProductVersion”, VERSIONINFO_VERSION_STRING "\0"
VALUE “OriginalFilename”, VERSIONINFO_FILENAME "\0"
VALUE “FileDescription”, VERSIONINFO_FILEDESCR "\0"
VALUE “InternalName”, EFFECT_NAME VERSIONINFO_VERSION_STRING "\0"
VALUE “ProductName”, EFFECT_NAME "\0"
VALUE “CompanyName”, VERSIONINFO_COMPANYNAME "\0"
VALUE “LegalCopyright”, VERSIONINFO_COPYRIGHT "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE “Translation”, 0x409, 1252
END
END

Each time you use the projucer the .rc file will be overwritten but on build, the right .rc file is used for the binary.

Frank.

1 Like