Results 1 to 3 of 3

Thread: Version Info in EXE, Access project file from resource.rc file?

  1. #1
    Join Date
    Jul 2015
    Posts
    87
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Version Info in EXE, Access project file from resource.rc file?

    Hello,

    i'm using this to include version information to my compiled EXE file:
    http://stackoverflow.com/questions/2...ile-on-windows

    resources.rc
    Qt Code:
    1. #include <windows.h>
    2.  
    3. #define VER_FILEVERSION 2,1,3,924
    4. #define VER_FILEVERSION_STR "2.1.3.924"
    5. #define VER_PRODUCTVERSION 2,1,3,924
    6. #define VER_PRODUCTVERSION_STR "2.1.3"
    7.  
    8. #define VER_COMPANYNAME_STR "Cool Company Pty Ltd"
    9. #define VER_FILEDESCRIPTION_STR "Cool Program"
    10. #define VER_INTERNALNAME_STR "Cool Program"
    11. #define VER_LEGALCOPYRIGHT_STR "Copyright 2012 Cool Company Pty Ltd"
    12. #define VER_LEGALTRADEMARKS1_STR ""
    13. #define VER_LEGALTRADEMARKS2_STR ""
    14. #define VER_ORIGINALFILENAME_STR "application.exe"
    15. #define VER_PRODUCTNAME_STR "Cool Program"
    16.  
    17. #ifndef DEBUG
    18. #define VER_DEBUG 0
    19. #else
    20. #define VER_DEBUG VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE|VS_FF_DEBUG
    21. #endif
    22.  
    23.  
    24. IDI_ICON1 ICON DISCARDABLE "ICON.ico"
    25.  
    26. VS_VERSION_INFO VERSIONINFO
    27. FILEVERSION VER_FILEVERSION
    28. PRODUCTVERSION VER_PRODUCTVERSION
    29. FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
    30.  
    31. FILEFLAGS ( VER_DEBUG )
    32. FILEOS VOS__WINDOWS32
    33. FILETYPE VFT_APP
    34. BEGIN
    35. BLOCK "StringFileInfo"
    36. BEGIN
    37. BLOCK "040904E4"
    38. BEGIN
    39. VALUE "CompanyName", VER_COMPANYNAME_STR
    40. VALUE "FileDescription", VER_FILEDESCRIPTION_STR
    41. VALUE "FileVersion", VER_FILEVERSION_STR
    42. VALUE "InternalName", VER_INTERNALNAME_STR
    43. VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
    44. VALUE "LegalTrademarks1", VER_LEGALTRADEMARKS1_STR
    45. VALUE "LegalTrademarks2", VER_LEGALTRADEMARKS2_STR
    46. VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
    47. VALUE "ProductName", VER_PRODUCTNAME_STR
    48. VALUE "ProductVersion", VER_PRODUCTVERSION_STR
    49. END
    50. END
    51.  
    52. BLOCK "VarFileInfo"
    53. BEGIN
    54. /* The following line should only be modified for localized versions. */
    55. /* It consists of any number of WORD,WORD pairs, with each pair */
    56. /* describing a language,codepage combination supported by the file. */
    57. /* */
    58. /* For example, a file might have values "0x409,1252" indicating that it */
    59. /* supports English language (0x409) in the Windows ANSI codepage (1252). */
    60.  
    61. VALUE "Translation", 0x409, 1252
    62.  
    63. END
    64. END
    To copy to clipboard, switch view to plain text mode 

    Questions:

    I have also some parameters in my Qt project file, like this:

    project.pro
    Qt Code:
    1. VERSION = 11.0.5
    2. DEFINES += APP_VERSION=\\\"$$VERSION\\\"
    To copy to clipboard, switch view to plain text mode 

    How can i access e.g. VERSION (located in my project.pro) from resources.rc?

    Thx
    Last edited by HappyCoder; 15th March 2016 at 16:53.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Version Info in EXE, Access project file from resource.rc file?

    Hmm, what if you do it the other way around.

    The rc file can obviously include headers, so you could have a simple header that just contains
    Qt Code:
    1. #define VERSION 11.0.5
    To copy to clipboard, switch view to plain text mode 
    And then use cat() and section() in the .pro to extract the version string into a qmake variable.

    Cheers,
    _

  3. The following 2 users say thank you to anda_skoa for this useful post:

    d_stranz (19th March 2016), HappyCoder (18th March 2016)

  4. #3
    Join Date
    Jul 2015
    Posts
    87
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Version Info in EXE, Access project file from resource.rc file?

    Quote Originally Posted by anda_skoa View Post
    And then use cat() and section() in the .pro to extract the version string into a qmake variable.
    Thx, works great!

Similar Threads

  1. How to show version info by right clicking a Qt executable file in Linux?
    By TheIndependentAquarius in forum Installation and Deployment
    Replies: 2
    Last Post: 18th July 2014, 07:44
  2. Qt version checking at the project-file
    By roxton in forum Qt Programming
    Replies: 5
    Last Post: 27th June 2013, 23:43
  3. Replies: 9
    Last Post: 9th April 2009, 06:49
  4. File version info
    By johncharlesb in forum Qt Programming
    Replies: 1
    Last Post: 19th October 2007, 02:59

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.