Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Using RC_FILE for an icon + embedded manifest + file properties
Forum Updated to NodeBB v4.3 + New Features

Using RC_FILE for an icon + embedded manifest + file properties

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 2.5k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    frankiefrank
    wrote on 19 Sept 2016, 07:00 last edited by frankiefrank
    #1

    Reposting this topic (with the replies) without a part of the code that shouldn't have been posted. I would have edited but it was also quoted... I'll mark as solved once I confirm a solution.

    I'm switching from MSVC to MinGW for my project, now on Qt 5.7.

    I used to modify some of the target executable's file and version information with my .pro file, using variables like QMAKE_TARGET_COPYRIGHT, QMAKE_TARGET_COMPANY, etc. That along with using VERSION and RC_ICONS would work fine. I also embedded a manifest because of a dependency, using the mt.exe tool.

    Now, however, I want everything to work with MinGW.

    So instead of the other keys I mentioned, I made a MyApp.rc file and referenced it in the .pro file:

    RC_FILE = MyApp.rc
    

    Inside the file I used the following code:

    1 ICON "MyApp.ico"
    CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "MyDependency.dll.manifest"
    2 VERSIONINFO
    FILEVERSION     2,0,0,0
    PRODUCTVERSION  2,0,0,0
    BEGIN
      BLOCK "StringFileInfo"
      BEGIN
        BLOCK "040904E4"
    	BEGIN
    	  VALUE "CompanyName", "MyCompany"
    	  VALUE "FileDescription", "Description"
    	  VALUE "InternalName", "MyApp"
    	  VALUE "LegalCopyright", "Copyright 2016 Me"
    	  VALUE "ProductName", "My Product"
    	END
      END
    END
    

    I see the icon updated but when I try to right-click the executable and check for properties of the file I don't see the version information parts. I'm using Windows 10.

    Can anyone help with a working RC_FILE example? I tried several from online sources but I still get the same result.

    @hskoglund said

    Hi getting the version info visible with right-click in Explorer is an arcane art, try something like this:

    1 ICON "MyApp.ico"
    CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "MyDependency.dll.manifest"
    
    #include <windows.h>
    LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
    
    VS_VERSION_INFO VERSIONINFO
    FILEVERSION     2,0,0,0
    PRODUCTVERSION  2,0,0,0
    BEGIN
      BLOCK "StringFileInfo"
      BEGIN
        BLOCK "040904E4"
    	BEGIN
    	  VALUE "CompanyName", "MyCompany"
    	  VALUE "FileDescription", "Description"
    	  VALUE "InternalName", "MyApp"
    	  VALUE "LegalCopyright", "Copyright 2016 Me"
    	  VALUE "ProductName", "My Product"
    	END
      END
    
      BLOCK "VarFileInfo"
      BEGIN
           VALUE "Translation", 0x409, 1252
      END
    
    END
    

    @Paul-Colby said

    Hi @frankiefrank,

    Your StringFileInfo block is missing a lot of parameters that are stated as required in Microsoft's StringFileInfo BLOCK statement documentation, such as FileVersion, OriginalFilename and ProductVersion.

    Personally, I'd either:

    1. revisit / rebuild one of your older versions, and pull out its *.rc file to use as a starting point; and/or
    2. take inspiration from qmake's Win32MakefileGenerator::processRcFileVar() function source; and/or
    3. begin with a known working *.rc file from another project, such as this one (here's another example from one of my open-source projects, which uses QMAKE_SUBSTITUTES (one of qmake's lesser-known features) to still be able to use qmake variables, such as $$VERSION, in the RC file).

    Cheers.

    "Roads? Where we're going, we don't need roads."

    1 Reply Last reply
    0
    • F Offline
      F Offline
      frankiefrank
      wrote on 19 Sept 2016, 09:35 last edited by
      #2

      Thank you!

      I solved this by following up on @Paul-Colby 's suggestion to start with an older build's .rc file.

      Here's my working version. I got my icon, my manifest AND the details appear correctly in the file properties.

      # if defined(UNDER_CE)
      #  include <winbase.h>
      # else
      #  include <windows.h>
      # endif
      
      IDI_ICON1	ICON	DISCARDABLE	"MyApp.ico"
      
      CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "Drivers\\MyDependency\\MyDependency.dll.manifest"
      
      VS_VERSION_INFO VERSIONINFO
          FILEVERSION 2,1,0,0
      	PRODUCTVERSION 2,1,0,0
      	FILEFLAGSMASK 0x3fL
      #ifdef _DEBUG
          FILEFLAGS VS_FF_DEBUG
      #else
          FILEFLAGS 0x0L
      #endif
          FILEOS VOS__WINDOWS32
      	FILETYPE VFT_DLL
      	FILESUBTYPE 0x0L
      	BEGIN
      	    BLOCK "StringFileInfo"
      		BEGIN
      		    BLOCK "040904b0"
      			BEGIN
      			    VALUE "CompanyName", "MyCompany\0"
      				VALUE "FileDescription", "Description\0"
      				VALUE "FileVersion", "2.1.0.0\0"
      				VALUE "LegalCopyright", "Copyright 2016 Me\0"
      				VALUE "OriginalFilename", "MyApp.exe\0"
      				VALUE "ProductName", "App\0"
      				VALUE "ProductVersion", "2.1.0.0\0"
      			END
      		END
      		BLOCK "VarFileInfo"
      		BEGIN
      		    VALUE "Translation", 0x0409, 1200
      		END
      	END
      /* End of Version info */
      

      @hskoglund I tried to use what you wrote first but got an error on LANGUAGE, saying Broken Pipe, so then I went on to try the other suggestions.

      "Roads? Where we're going, we don't need roads."

      1 Reply Last reply
      2

      1/2

      19 Sept 2016, 07:00

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved