Re: Version resource missing in MFC exe
Bill Cumming schrieb:
David - Alas I cannot take out the
!(defined(XSCRIBE) || defined(STRESSVUE))
without also deleting the other version resources for the other builds. But
just for grins I did just that so that there is only one version resource
that starts with:
#if defined(APSTUDIO_INVOKED)
VS_VERSION_INFO VERSIONINFO
and now I get NO version tab in the Explorer file properties dialog!
Ah, now your error becomes clear. I over-read that in your first mail that the
version tab exists but is empty.
Supporting multi-language version information works a little different. Version
Information consosts of multiple blocks: A binary structure at the beginning,
followed by zero ore more StringFileInfo blocks and zero or more VarFileInfo blocks.
To use multiple languages, you need to create a StringFileInfo record for each
language, with something like the language Id or locale id as name. The explorer
tries to find a matching language and displays the string version info that
mathes tha language best. I guess there is also the Translation section
involved, but I don't know the details.
You add more StringFileInfo blocks in the resource editor: Right click in the
version resource and select "New Version Info Block". THe language can be set in
the version info block's properties.
A version info for German and English might look like this (Generated from the
Resource editor):
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040704b0"
BEGIN
VALUE "FileDescription", "mfctest Application"
VALUE "FileVersion", "1, 0, 0, 1"
VALUE "InternalName", "mfctest"
VALUE "LegalCopyright", "Copyright (C) 2008"
VALUE "OriginalFilename", "mfctest.exe"
VALUE "ProductName", "mfctest Application"
VALUE "ProductVersion", "1, 0, 0, 1"
END
BLOCK "040904e4"
BEGIN
VALUE "CompanyName", "TODO: <Company name>"
VALUE "FileDescription", "TODO: <File description>"
VALUE "FileVersion", "1.0.0.1"
VALUE "InternalName", "mfctest.exe"
VALUE "LegalCopyright", "TODO: (c) <Company name>. All rights
reserved."
VALUE "OriginalFilename", "mfctest.exe"
VALUE "ProductName", "TODO: <Product name>"
VALUE "ProductVersion", "1.0.0.1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x407, 1200, 0x409, 1252
END
END
Norbert
Also, I
had previously inserted a #error statement into each version resource block
just before the lines:
BEGIN
BLOCK "StringFileInfo"
and the compiler would generate an error as expected. Sorry I didn't post
that exact example.
And I'm looking in Windows Explorer in WinXP Pro at the file properties.
Haven't tried Vista. And I opened the EXE in Studio 2005 (you have to use
File Open - drag and drop puts up a message telling you so) and it indeed
sees the (one) version resource corresponding to which build I executed.
Is it possible it's being compiled in a way that puts the resources in a
non-standard place in the EXE that Explorer doesn't recognize?