Is it possible to have a different application name for 32 bit v 64 bit with MFC?

Viewed 190

Is it possible to have a different application name for 32 bit v 64 bit?

enter image description here

I would like my application name to state (32 bit) or (64 bit) respectively.

2 Answers

Yes! You can use a conditional #ifdef ... #else ... #endif block in your .rc file, so you'll probably have to manually edit it, or put your VERSIONINFO block into an .rc2 file that's included by the main .rc.

Like this:

VS_VERSION_INFO VERSIONINFO
    FILEFLAGSMASK   VS_FFI_FILEFLAGSMASK
    FILEFLAGS       0
    FILEOS          VOS__WINDOWS32
    FILETYPE        VFT_APP
    FILESUBTYPE     0
    {
        BLOCK "StringFileInfo"
        {
            BLOCK "080904b0"
            {
                //...
                #ifdef _WIN64
                VALUE "FileDescription",  "My Application: 64-bit\0"
                #else
                VALUE "FileDescription",  "My Application: 32-bit\0"
                #endif
            }
        }
    }

But note, the resource compiler doesn't automatically define the _WIN64 macro, so you'll need to add it (or something similar) as a platform-specific property:

enter image description here

The IDE has a macro defined already PlatformShortName=x86|x64. To use that in the resource file:

  • define a macro in project settings under Resources / General / Preprocessor Definitions for all configurations and platforms as
    "TARGET=\"$(PlatformShortName)\""
  • edit the .rc file as text and edit the VS_VERSION_INFO VERSIONINFO section to replace
    VALUE "FileDescription", "SomeLabel"

with

    VALUE "FileDescription", "SomeLabel (" TARGET ")"

The file description compiled into the binary will now be SomeLabel (x86) or SomeLabel (x64).

The modified .rc file will no longer be recognized by the IDE resource editor because of the macro presence, so you may want to move the edited VERSIONINFO to the .rc2 file instead.

Related